Click here to Skip to main content
15,885,811 members
Home / Discussions / C#
   

C#

 
AnswerRe: Temporal Nulls in C# Pin
Pete O'Hanlon27-Oct-20 9:55
mvePete O'Hanlon27-Oct-20 9:55 
AnswerRe: Temporal Nulls in C# Pin
BillWoodruff27-Oct-20 10:17
professionalBillWoodruff27-Oct-20 10:17 
QuestionProgramming C # Pin
Immanuel Hitila26-Oct-20 12:10
Immanuel Hitila26-Oct-20 12:10 
AnswerRe: Programming C # Pin
Pete O'Hanlon26-Oct-20 12:16
mvePete O'Hanlon26-Oct-20 12:16 
GeneralRe: Programming C # Pin
Immanuel Hitila26-Oct-20 12:21
Immanuel Hitila26-Oct-20 12:21 
AnswerRe: Programming C # Pin
Richard Andrew x6426-Oct-20 14:06
professionalRichard Andrew x6426-Oct-20 14:06 
AnswerRe: Programming C # Pin
OriginalGriff26-Oct-20 21:14
mveOriginalGriff26-Oct-20 21:14 
QuestionHow to launch a form only once Pin
Ismael_199926-Oct-20 7:57
Ismael_199926-Oct-20 7:57 
Hi, folks.
I’m developing an application in C# using Visual Studio. This application has a parent form from which the user can call other forms. My original problem was: if the user has already launched a form and he clicks again in the menu item to launch the same form, the program should only focus on the form. If the form is not on screen, the program should launch it. Another problem is that I have 1 form that is launched with 2 different data sets (different tables in a DB).
I solved this problem this way: I declared 2 variables for the forms and defined 2 routines:
private void M2_SaidaEfetiva_Click(object sender, EventArgs e)
        {
            if (FormEfetivas == null)
            {
                FormEfetivas = new Frm_Saida();
                FormEfetivas.MdiParent = this;
                FormEfetivas.Text = "Saídas Efetivas";
                FormEfetivas.Tag = "1";
                FormEfetivas.Show();
            }
            FormEfetivas.Activate();
        }
        private void M2_SaidaPrevisao_Click(object sender, EventArgs e)
        {
            if (FormPrevisao == null)
            {
                FormPrevisao = new Frm_Saida();
                FormPrevisao.MdiParent = this;
                FormPrevisao.Text = "Previsão de Saídas";
                FormPrevisao.Tag = "0";
                FormPrevisao.Show();
            }
Now the problem is: when the user opens one form, then closes it, he cannot reopen it again, because the variables (FormEfetivas and FormPrevisao) are not eliminated when the user closes the form.
What am I forgetting here? Can anybody help me?
Thanks.
AnswerRe: How to launch a form only once Pin
OriginalGriff26-Oct-20 8:35
mveOriginalGriff26-Oct-20 8:35 
GeneralRe: How to launch a form only once Pin
Ismael_199926-Oct-20 10:09
Ismael_199926-Oct-20 10:09 
GeneralRe: How to launch a form only once Pin
OriginalGriff26-Oct-20 21:15
mveOriginalGriff26-Oct-20 21:15 
GeneralRe: How to launch a form only once Pin
Ismael_199927-Oct-20 10:40
Ismael_199927-Oct-20 10:40 
GeneralRe: How to launch a form only once Pin
OriginalGriff27-Oct-20 10:42
mveOriginalGriff27-Oct-20 10:42 
AnswerRe: How to launch a form only once Pin
Gerry Schmitz26-Oct-20 14:50
mveGerry Schmitz26-Oct-20 14:50 
AnswerRe: How to launch a form only once Pin
Richard Deeming26-Oct-20 22:10
mveRichard Deeming26-Oct-20 22:10 
QuestionDesign an elegant solution for choosing a class whose method gets called Pin
Member 1497555126-Oct-20 6:13
Member 1497555126-Oct-20 6:13 
AnswerRe: Design an elegant solution for choosing a class whose method gets called Pin
Gerry Schmitz26-Oct-20 14:58
mveGerry Schmitz26-Oct-20 14:58 
Questionan apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff25-Oct-20 22:18
professionalBillWoodruff25-Oct-20 22:18 
AnswerRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox25-Oct-20 22:58
professionalpkfox25-Oct-20 22:58 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff25-Oct-20 23:15
professionalBillWoodruff25-Oct-20 23:15 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox25-Oct-20 23:59
professionalpkfox25-Oct-20 23:59 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 2:13
professionalBillWoodruff26-Oct-20 2:13 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox26-Oct-20 2:48
professionalpkfox26-Oct-20 2:48 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
F-ES Sitecore26-Oct-20 1:15
professionalF-ES Sitecore26-Oct-20 1:15 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 2:09
professionalBillWoodruff26-Oct-20 2:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.