Click here to Skip to main content
15,880,725 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: ThreeState checkBox? Pin
Mycroft Holmes23-May-09 17:45
professionalMycroft Holmes23-May-09 17:45 
AnswerRe: ThreeState checkBox? Pin
Luc Pattyn23-May-09 17:05
sitebuilderLuc Pattyn23-May-09 17:05 
AnswerRe: ThreeState checkBox? Pin
PIEBALDconsult23-May-09 17:52
mvePIEBALDconsult23-May-09 17:52 
GeneralRe: ThreeState checkBox? Pin
Xenoserv23-May-09 21:20
Xenoserv23-May-09 21:20 
AnswerRe: ThreeState checkBox? Pin
DaveyM6924-May-09 0:53
professionalDaveyM6924-May-09 0:53 
QuestionInstall Files In Root Directory Pin
BlitzPackage23-May-09 12:30
BlitzPackage23-May-09 12:30 
AnswerRe: Install Files In Root Directory Pin
Luc Pattyn23-May-09 12:40
sitebuilderLuc Pattyn23-May-09 12:40 
GeneralRe: Install Files In Root Directory Pin
BlitzPackage23-May-09 12:54
BlitzPackage23-May-09 12:54 
GeneralRe: Install Files In Root Directory Pin
Luc Pattyn23-May-09 13:04
sitebuilderLuc Pattyn23-May-09 13:04 
GeneralRe: Install Files In Root Directory Pin
BlitzPackage23-May-09 13:15
BlitzPackage23-May-09 13:15 
AnswerRe: Install Files In Root Directory Pin
harold aptroot23-May-09 12:59
harold aptroot23-May-09 12:59 
AnswerRe: Install Files In Root Directory Pin
BlitzPackage23-May-09 13:10
BlitzPackage23-May-09 13:10 
AnswerRe: Install Files In Root Directory Pin
Eddy Vluggen23-May-09 21:10
professionalEddy Vluggen23-May-09 21:10 
Questionhow to make the service to get stopped by itself once it has performed its job? Pin
Gilly Kumar23-May-09 12:09
Gilly Kumar23-May-09 12:09 
AnswerRe: how to make the service to get stopped by itself once it has performed its job? Pin
PIEBALDconsult23-May-09 17:54
mvePIEBALDconsult23-May-09 17: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.