Click here to Skip to main content
15,889,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: search in site Pin
Manas Bhardwaj24-May-09 1:18
professionalManas Bhardwaj24-May-09 1:18 
GeneralRe: search in site Pin
michaelgr124-May-09 1:31
michaelgr124-May-09 1:31 
QuestionRefresh Datagrid Pin
KIDYA23-May-09 23:20
KIDYA23-May-09 23:20 
QuestionCalling Method of an Active Form from the MDI Parent Pin
uygarer23-May-09 23:13
uygarer23-May-09 23:13 
AnswerRe: Calling Method of an Active Form from the MDI Parent Pin
Moreno Airoldi24-May-09 0:12
Moreno Airoldi24-May-09 0:12 
AnswerRe: Calling Method of an Active Form from the MDI Parent Pin
DaveyM6924-May-09 0:25
professionalDaveyM6924-May-09 0:25 
QuestionFunction Caller Pin
Saiyed Alam23-May-09 22:56
Saiyed Alam23-May-09 22:56 
AnswerRe: Function Caller Pin
DaveyM6923-May-09 23:02
professionalDaveyM6923-May-09 23:02 
GeneralRe: Function Caller Pin
Mycroft Holmes23-May-09 23:38
professionalMycroft Holmes23-May-09 23:38 
GeneralRe: Function Caller Pin
DaveyM6924-May-09 0:05
professionalDaveyM6924-May-09 0:05 
GeneralRe: Function Caller Pin
Daniel Grunwald24-May-09 4:32
Daniel Grunwald24-May-09 4:32 
AnswerRe: Function Caller Pin
Mycroft Holmes23-May-09 23:35
professionalMycroft Holmes23-May-09 23:35 
Questiondownload at internet bandwith with c# Pin
Abdul Rahman Hamidy23-May-09 22:26
Abdul Rahman Hamidy23-May-09 22:26 
Question[Message Deleted] Pin
hkjghkj123-May-09 21:28
hkjghkj123-May-09 21:28 
AnswerRe: filter Pin
Eddy Vluggen23-May-09 21:51
professionalEddy Vluggen23-May-09 21:51 
General[Message Deleted] Pin
hkjghkj123-May-09 23:34
hkjghkj123-May-09 23:34 
GeneralRe: filter Pin
Eddy Vluggen23-May-09 23:48
professionalEddy Vluggen23-May-09 23:48 
QuestionTo add headertemplate and contenttemplate of a TabContainer Programaticaly [modified] Pin
Shahdat Hosain23-May-09 20:48
Shahdat Hosain23-May-09 20:48 
QuestionDESCryptoServiceProvider - key size (public key from mykeys.snk not compatible) Pin
devvvy23-May-09 18:56
devvvy23-May-09 18:56 
QuestionCrystal report Pin
KIDYA23-May-09 18:50
KIDYA23-May-09 18:50 
AnswerRe: Crystal report Pin
_Maxxx_24-May-09 16:57
professional_Maxxx_24-May-09 16:57 
QuestionX509 makecert from snk file (sn.exe)? Pin
devvvy23-May-09 17:44
devvvy23-May-09 17:44 
QuestionThreeState checkBox? Pin
Xenoserv23-May-09 16:17
Xenoserv23-May-09 16:17 
I'm having a problem with the ThreeState property. Currently, the checkBox's only have the values of "0" and "1", and I need the ThreeState to equal "2" somehow!

This code creates the checkBox's:
private void makeArea_Click(object sender, EventArgs e)
{
    if ((areaXNumber.Value <= 11) && (areaYNumber.Value <= 11))
    {
        arrX = Convert.ToInt32(areaXNumber.Value);
        arrY = Convert.ToInt32(areaYNumber.Value);
        panel1.Controls.Clear();
        int x, y = 12;
        for (int j = 0; j < arrY; j++)
        {
            x = 12;
            for (int i = 0; i < arrX; i++)
            {
                CheckBox chkb = new CheckBox();
                chkb.Location = new Point(x, y);
                chkb.Size = new Size(15, 14);
                panel1.Controls.Add(chkb);
                x += 21;
            }
            y += 21;
        }
    }
    else
    {
        MessageBox.Show("Lower your checkbox amount!");
    }
}


This code appends it all to a StringBuilder then posts it to a richTextBox:
private void insertArea_Click(object sender, EventArgs e)
{
    StringBuilder area = new StringBuilder();
    if (panel1.Controls.Count > 0)
    {
        area.AppendLine();
        area.AppendLine("arr" + areaArrayNumber.Value + " = {");
        for (int i = 0; i < arrX * arrY; i++)
        {
            if (i % arrX == 0)
                area.Append("{");
            area.Append(Convert.ToByte(((CheckBox)panel1.Controls[i]).Checked));
            if (i % arrX == arrX - 1)
            {
                if (i + 1 == arrX * arrY) area.Append("}\n");
                else area.Append("},\n");
            }
            else area.Append(", ");

        }
        area.AppendLine("}");
    }
    else
    MessageBox.Show("There are no checkboxes!", "Error");
    scriptForm.Text += area.ToString();
}


What this code does, is let the user decide how many checkBox's on the X axis, then the Y axis, so let's say numericalUpDown1 and numericalUpDown2 value's are equal to 3. This is what the outcome is currently (1 = Checked/0 = Unchecked):
arr1 = {
{1, 1, 1},
{1, 0, 1},
{1, 1, 1}
}


I want the ThreeState to be able to do this (2 = Third State/1 = Checked/0 = Unchecked):
arr1 = {
{1, 1, 1},
{1, 2, 1},
{1, 1, 1}
}



I hope this is enough information to help! If not, please let me know. I appreciate your time reading this!
AnswerRe: ThreeState checkBox? Pin
Mycroft Holmes23-May-09 16:40
professionalMycroft Holmes23-May-09 16:40 
GeneralRe: ThreeState checkBox? Pin
Xenoserv23-May-09 17:02
Xenoserv23-May-09 17:02 

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.