Click here to Skip to main content
14,697,697 members
Home » Discussions » C#
   

C#

 
AnswerRe: Temporal Nulls in C# Pin
Pete O'Hanlon27-Oct-20 10:55
subeditorPete O'Hanlon27-Oct-20 10:55 
AnswerRe: Temporal Nulls in C# Pin
BillWoodruff27-Oct-20 11:17
mveBillWoodruff27-Oct-20 11:17 
QuestionProgramming C # Pin
Immanuel Hitila26-Oct-20 13:10
MemberImmanuel Hitila26-Oct-20 13:10 
AnswerRe: Programming C # Pin
Pete O'Hanlon26-Oct-20 13:16
subeditorPete O'Hanlon26-Oct-20 13:16 
GeneralRe: Programming C # Pin
Immanuel Hitila26-Oct-20 13:21
MemberImmanuel Hitila26-Oct-20 13:21 
AnswerRe: Programming C # Pin
Richard Andrew x6426-Oct-20 15:06
professionalRichard Andrew x6426-Oct-20 15:06 
AnswerRe: Programming C # Pin
OriginalGriff26-Oct-20 22:14
mveOriginalGriff26-Oct-20 22:14 
QuestionHow to launch a form only once Pin
Member 1479239326-Oct-20 8:57
MemberMember 1479239326-Oct-20 8: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 9:35
mveOriginalGriff26-Oct-20 9:35 
GeneralRe: How to launch a form only once Pin
Member 1479239326-Oct-20 11:09
MemberMember 1479239326-Oct-20 11:09 
GeneralRe: How to launch a form only once Pin
OriginalGriff26-Oct-20 22:15
mveOriginalGriff26-Oct-20 22:15 
GeneralRe: How to launch a form only once Pin
Member 1479239327-Oct-20 11:40
MemberMember 1479239327-Oct-20 11:40 
GeneralRe: How to launch a form only once Pin
OriginalGriff27-Oct-20 11:42
mveOriginalGriff27-Oct-20 11:42 
AnswerRe: How to launch a form only once Pin
Gerry Schmitz26-Oct-20 15:50
mveGerry Schmitz26-Oct-20 15:50 
AnswerRe: How to launch a form only once Pin
Richard Deeming26-Oct-20 23:10
mveRichard Deeming26-Oct-20 23:10 
QuestionDesign an elegant solution for choosing a class whose method gets called Pin
Member 1497555126-Oct-20 7:13
MemberMember 1497555126-Oct-20 7:13 
AnswerRe: Design an elegant solution for choosing a class whose method gets called Pin
Gerry Schmitz26-Oct-20 15:58
mveGerry Schmitz26-Oct-20 15:58 
Questionan apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff25-Oct-20 23:18
mveBillWoodruff25-Oct-20 23:18 
AnswerRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox25-Oct-20 23:58
professionalpkfox25-Oct-20 23:58 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 0:15
mveBillWoodruff26-Oct-20 0:15 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox26-Oct-20 0:59
professionalpkfox26-Oct-20 0:59 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 3:13
mveBillWoodruff26-Oct-20 3:13 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
pkfox26-Oct-20 3:48
professionalpkfox26-Oct-20 3:48 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
F-ES Sitecore26-Oct-20 2:15
mveF-ES Sitecore26-Oct-20 2:15 
GeneralRe: an apparent violation of C#-generic "physics" ? (language issue) Pin
BillWoodruff26-Oct-20 3:09
mveBillWoodruff26-Oct-20 3: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.