Click here to Skip to main content
15,894,410 members
Home / Discussions / C#
   

C#

 
GeneralRe: Retrieving multiple items from listview Pin
King Julien7-Apr-09 20:58
King Julien7-Apr-09 20:58 
GeneralRe: Retrieving multiple items from listview [modified] Pin
mrithula87-Apr-09 21:05
mrithula87-Apr-09 21:05 
GeneralRe: Retrieving multiple items from listview Pin
King Julien7-Apr-09 23:32
King Julien7-Apr-09 23:32 
GeneralRe: Retrieving multiple items from listview Pin
mrithula88-Apr-09 0:04
mrithula88-Apr-09 0:04 
GeneralRe: Retrieving multiple items from listview Pin
King Julien8-Apr-09 0:12
King Julien8-Apr-09 0:12 
GeneralRe: Retrieving multiple items from listview Pin
mrithula88-Apr-09 1:12
mrithula88-Apr-09 1:12 
GeneralRe: Retrieving multiple items from listview Pin
King Julien8-Apr-09 1:14
King Julien8-Apr-09 1:14 
GeneralRe: Retrieving multiple items from listview Pin
mrithula88-Apr-09 1:30
mrithula88-Apr-09 1:30 
hi I have another doubt.If i want to find the selected index of a listbox or a listview control i can use listbox.SelectedIndex; Similarly if i have 5 checkboxes and if i want to find the index of the checkbox that is checked how do i do this?There is no Selected Index property for checkbox.

I have the exe files listed and each one is assigned a checkbox.I want to start only those exe files that i select.I am able to do this.After starting the exe files i want the client to send message to only those exe files that have been started.

I used the following code to send message to different ports
<pre>public void SendMessage()
{

try
{

label1.Text = "Enter the number of times to send the message:";
String ns = textBox1.Text;
int c = Convert.ToInt32(ns);

int[] a = new int[4];
XmlTextReader xtr1 = new XmlTextReader("p1.xml");
XmlTextReader xtr2 = new XmlTextReader("p2.xml");
XmlTextReader xtr3 = new XmlTextReader("p3.xml");
XmlTextReader xtr4 = new XmlTextReader("p4.xml");
int p1 = 0, p2 = 0, p3 = 0, p4 = 0;
while (xtr1.Read())
{
switch (xtr1.NodeType)
{
case XmlNodeType.Text:

String rv = xtr1.Value;
p1 = Convert.ToInt32(rv);
break;
}
}

while (xtr2.Read())
{
switch (xtr2.NodeType)
{
case XmlNodeType.Text:

String rv1 = xtr2.Value;
p2 = Convert.ToInt32(rv1);
break;
}
}

while (xtr3.Read())
{
switch (xtr3.NodeType)
{
case XmlNodeType.Text:

String rv2 = xtr3.Value;
p3 = Convert.ToInt32(rv2);
break;
}
}

while (xtr4.Read())
{
switch (xtr4.NodeType)
{
case XmlNodeType.Text:

String rv3 = xtr4.Value;
p4 = Convert.ToInt32(rv3);
break;
}
}
a[0] = p1;
a[1] = p2;
a[2] = p3;
a[3] = p4;
listBox2.Items.Add("Connecting....");
ch[0] = cb;
ch[1] = cb1;
ch[2] = cb3;
ch[3] = cb4;



//int r=cb

for (int i = 0; i <= c; i++)
//int i = 0;

//while (i <= 1)
{

UdpClient client = new UdpClient("127.0.0.1", a[i]);
listBox2.Items.Add("Connected");
Byte[] data = new Byte[256];
String snd = "hello";
data = Encoding.ASCII.GetBytes(snd);
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), a[i]);
int n = client.Send(data, data.Length);
listBox2.Items.Add("Sent...");
listBox2.Items.Add("Message received from {0}:");
listBox2.Items.Add(ipep.ToString());
Byte[] received = new Byte[512];
received = client.Receive(ref ipep);
String dataReceived = System.Text.Encoding.ASCII.GetString(received);
listBox2.Items.Add(dataReceived);
listBox2.Items.Add("======================================================================");
if (dataReceived == "Welcome to the Server")
{
if (cb.Checked == true && lb4.Text != "")
{
lb8.Text = "Active";
lb8.BackColor = System.Drawing.Color.Green;
}
if (cb1.Checked == true && lb5.Text != "")
{
lb9.Text = "Active";
lb9.BackColor = System.Drawing.Color.Green;
}
if (cb3.Checked == true && lb6.Text != "")
{
lb10.Text = "Active";
lb10.BackColor = System.Drawing.Color.Green;
}
if (cb4.Checked == true && lb7.Text != "")
{
lb11.Text = "Active";
lb11.BackColor = System.Drawing.Color.Green;
}
}
else
{
lb8.Text = "Inactive";
lb8.BackColor = System.Drawing.Color.Red;

lb9.Text = "InActive";
lb9.BackColor = System.Drawing.Color.Red;

lb10.Text = "InActive";
lb10.BackColor = System.Drawing.Color.Red;

lb11.Text = "InActive";
lb11.BackColor = System.Drawing.Color.Red;
}

client.Close();

}


}
catch (Exception e)
{
listBox2.Items.Add("An Exception Occurred!");
listBox2.Items.Add(e.ToString());
}


}
GeneralRe: Retrieving multiple items from listview Pin
King Julien8-Apr-09 2:45
King Julien8-Apr-09 2:45 
QuestionHow append css in html at run time Pin
sushilabhanvar3-Apr-09 1:21
sushilabhanvar3-Apr-09 1:21 
AnswerRe: How append css in html at run time Pin
Rajdeep.NET is BACK3-Apr-09 1:42
Rajdeep.NET is BACK3-Apr-09 1:42 
QuestionInstall setup only on one PC Pin
sjs4u3-Apr-09 1:00
sjs4u3-Apr-09 1:00 
AnswerRe: Install setup only on one PC Pin
King Julien3-Apr-09 1:14
King Julien3-Apr-09 1:14 
AnswerRe: Install setup only on one PC Pin
Rajdeep.NET is BACK3-Apr-09 1:38
Rajdeep.NET is BACK3-Apr-09 1:38 
GeneralRe: Install setup only on one PC Pin
sjs4u3-Apr-09 1:42
sjs4u3-Apr-09 1:42 
GeneralRe: Install setup only on one PC Pin
Rajdeep.NET is BACK3-Apr-09 1:46
Rajdeep.NET is BACK3-Apr-09 1:46 
QuestionHow to Read data of a file from application setup in c#.net windows Application Pin
Narendra Reddy Vajrala3-Apr-09 0:39
Narendra Reddy Vajrala3-Apr-09 0:39 
RantRe: How to Read data of a file from application setup Pin
musefan3-Apr-09 0:44
musefan3-Apr-09 0:44 
RantRe: How to Read data of a file from application setup Pin
Narendra Reddy Vajrala3-Apr-09 1:02
Narendra Reddy Vajrala3-Apr-09 1:02 
GeneralRe: How to Read data of a file from application setup Pin
musefan3-Apr-09 1:05
musefan3-Apr-09 1:05 
GeneralRe: How to Read data of a file from application setup Pin
Nagy Vilmos3-Apr-09 1:06
professionalNagy Vilmos3-Apr-09 1:06 
AnswerRe: How to Read data of a file from application setup Pin
King Julien3-Apr-09 1:17
King Julien3-Apr-09 1:17 
GeneralRe: How to Read data of a file from application setup Pin
Narendra Reddy Vajrala3-Apr-09 1:24
Narendra Reddy Vajrala3-Apr-09 1:24 
GeneralRe: How to Read data of a file from application setup Pin
King Julien3-Apr-09 1:28
King Julien3-Apr-09 1:28 
GeneralRe: How to Read data of a file from application setup Pin
Narendra Reddy Vajrala3-Apr-09 2:03
Narendra Reddy Vajrala3-Apr-09 2:03 

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.