Click here to Skip to main content
16,013,642 members
Home / Discussions / C#
   

C#

 
GeneralRe: MS word tables using C# Pin
Member 41540746-Aug-09 21:51
Member 41540746-Aug-09 21:51 
GeneralRe: MS word tables using C# Pin
toby316-Aug-09 22:09
toby316-Aug-09 22:09 
GeneralRe: MS word tables using C# Pin
Member 41540747-Aug-09 7:58
Member 41540747-Aug-09 7:58 
QuestionProblem Calling CheckListBox Pin
Member 28652716-Aug-09 7:31
Member 28652716-Aug-09 7:31 
AnswerRe: Problem Calling CheckListBox Pin
Andrew Rissing6-Aug-09 7:56
Andrew Rissing6-Aug-09 7:56 
AnswerRe: Problem Calling CheckListBox Pin
Luc Pattyn6-Aug-09 7:56
sitebuilderLuc Pattyn6-Aug-09 7:56 
GeneralRe: Problem Calling CheckListBox Pin
Member 28652716-Aug-09 11:48
Member 28652716-Aug-09 11:48 
AnswerRe: Problem Calling CheckListBox Pin
DaveyM696-Aug-09 11:14
professionalDaveyM696-Aug-09 11:14 
What you're trying to do, or at least the way you're trying to do it, seems a little bit strange.

This code works for me. Just a default project with a Form1 and Form2 added - everything else in done in code.
// Form1.cs

using System;
using System.Windows.Forms;

public partial class Form1 : Form
{
    private Form2 form2;

    public Form1()
    {
        InitializeComponent();
        Button button = new Button();
        Controls.Add(button);
        button.Click += button_Click;
    }

    void button_Click(object sender, EventArgs e)
    {
        CheckForm2Instance();
        form2.DoStuffWithCheckBox();
    }

    void CheckForm2Instance()
    {
        if (form2 == null)
        {
            form2 = new Form2();
            form2.FormClosing += form2_FormClosing;
        }
        form2.Show();
    }

    void form2_FormClosing(object sender, FormClosingEventArgs e)
    {
        form2.FormClosing -= form2_FormClosing;
        form2 = null;
    }
}
// Form2.cs

using System.Windows.Forms;

public partial class Form2 : Form
{
    public Form2()
    {
        InitializeComponent();
        CheckedListBox checkedListBox = new CheckedListBox();
        Controls.Add(checkedListBox);
        checkedListBox.Items.AddRange(new object[] { "A", "B", "C" });
    }

    public void DoStuffWithCheckBox()
    {
        MessageBox.Show("Doing Stuff");
    }
}


Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: Problem Calling CheckListBox Pin
Member 28652716-Aug-09 15:01
Member 28652716-Aug-09 15:01 
Questionread Sql DataBase Error Pin
toby316-Aug-09 7:28
toby316-Aug-09 7:28 
AnswerRe: read Sql DataBase Error Pin
musefan6-Aug-09 7:32
musefan6-Aug-09 7:32 
GeneralRe: read Sql DataBase Error Pin
toby316-Aug-09 7:34
toby316-Aug-09 7:34 
GeneralRe: read Sql DataBase Error Pin
Ashfield6-Aug-09 8:51
Ashfield6-Aug-09 8:51 
AnswerRe: read Sql DataBase Error Pin
dan!sh 6-Aug-09 8:52
professional dan!sh 6-Aug-09 8:52 
AnswerRe: read Sql DataBase Error Pin
toby317-Aug-09 0:33
toby317-Aug-09 0:33 
QuestionC# PDB symbols Pin
nachiket076-Aug-09 7:23
nachiket076-Aug-09 7:23 
AnswerRe: C# PDB symbols Pin
Eddy Vluggen6-Aug-09 8:19
professionalEddy Vluggen6-Aug-09 8:19 
GeneralRe: C# PDB symbols Pin
nachiket076-Aug-09 8:24
nachiket076-Aug-09 8:24 
GeneralRe: C# PDB symbols Pin
Eddy Vluggen6-Aug-09 8:46
professionalEddy Vluggen6-Aug-09 8:46 
GeneralRe: C# PDB symbols Pin
nachiket076-Aug-09 8:54
nachiket076-Aug-09 8:54 
GeneralRe: C# PDB symbols Pin
Eddy Vluggen6-Aug-09 11:34
professionalEddy Vluggen6-Aug-09 11:34 
Question.chm File HTML contens will not be shown under (XP) Pin
fracalifa6-Aug-09 7:06
fracalifa6-Aug-09 7:06 
AnswerRe: .chm File HTML contens will not be shown under (XP) Pin
Andrew Rissing6-Aug-09 7:44
Andrew Rissing6-Aug-09 7:44 
GeneralRe: .chm File HTML contens will not be shown under (XP) Pin
fracalifa6-Aug-09 21:22
fracalifa6-Aug-09 21:22 
AnswerRe: .chm File HTML contens will not be shown under (XP) Pin
Henry Minute6-Aug-09 10:54
Henry Minute6-Aug-09 10:54 

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.