Hi I`m new int C# and I want to make an non-oriented graph using windows forms. In a label I will put the question "It is a
node between: " and in a text box to appear a[1,1] if it is click YES if
not click NO. After clicking the text box will change to a[1,2] and so
on ...
Loading
eleodorPosted Dec 29, 2010, 1:22 PM
FroglegPosted Dec 29, 2010, 11:00 AM
public partial class Form1 : Form
{
int mIndex1, mIndex2,uIndex;
string cm = " , ";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
mIndex1 = 0;
mIndex2 = 0;
uIndex = 0;
}
private void bttnRead_Click(object sender, EventArgs e)
{
uIndex = Convert.ToInt32(textBox1.Text);
textBox2.Text = (Convert.ToString(mIndex1) + cm + Convert.ToString(mIndex2));
textBox3.Text = string.Empty;
mIndex1 = 0;
mIndex2 = 0;
}
private void bttnYes_Click(object sender, EventArgs e)
{
}
private void bttnNo_Click(object sender, EventArgs e)
{
if (mIndex2 < uIndex && mIndex1 != uIndex)
{
mIndex2++;
}
else if (mIndex1 == uIndex)
{
textBox3.Text = ("Finished looping");
return;
}
else if (mIndex1 < uIndex && mIndex2 == uIndex)
{
mIndex1++;
mIndex2 = 0;
}
textBox2.Text = (Convert.ToString(mIndex1) + cm + Convert.ToString(mIndex2));
}
}
eleodorPosted Dec 29, 2010, 9:14 AM
in the result will appear for eg:
1 0 1
0 1 1
1 1 1 depending on response
But the problem for me is how to make the looping in text box ...
Tx
FroglegPosted Dec 28, 2010, 2:52 PM
public partial class Form1 : Form
{
int index = 1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Text = ("It is a node between: ");
}
private void bttnYes_Click(object sender, EventArgs e)
{
textBox1.Text = ("a[1," + Convert.ToString(index) +"]");
}
private void bttnNo_Click(object sender, EventArgs e)
{
index++;
textBox1.Text = ("a[1," + Convert.ToString(index) + "]"); ;
}
}