|
rohitsrivastava wrote: yes
|
|
|
|
|
Why do I get the feeling the OP is going to copy'n'paste the code thrown at him and wonder why it doesn't work?
|
|
|
|
|
How to Fill Combo Box From SQL2000 Tables
SAS
|
|
|
|
|
SqlCommand cmd = new SqlCommand("SELECT [field] FROM table",connection);
SqlDataReader dataReader = cmd.ExecuteDataReader();
while(dataReader.Read())
{
comboBox1.Items.Add(new llistItem(dataRead[0],dataRead[0]);
}
dataRead.Close();
Hope this helps
|
|
|
|
|
hi this is the coding to fill the combo
strselect="select fieldname from tablename "
objsqlconn=new sqlconnection("userid=sa;password=;data source=servername")
objsqlconn.open()
objdataset=new dataset
objsqlcmd=new sqlcommand(strselect,objsqlconn)
objsqldataadapter=new sqldataadapter(objsqlcmd)
objsqldataadapter.fill(objdataset,"Tablename")
cmbname.datasourc=objdataset.table("Tablename")
cmbname.displaymember="Fieldname"
cmbname.displayvalue="fieldname"
this is how to fill the combo
have a nice day
|
|
|
|
|
when I iterate through form controls and their child controls
it works fine for every thing else expect when it comes to menu items it only returns only
the top item and not the child ones
the code I am using is
void ModifyControls(Control.ControlCollection ControlCollection)
{
for (int i = 0; i < ControlCollection.Count; i++)
{
if (ControlCollection[i].GetType() != typeof(Menu))
{
Array.Resize(ref Controls, Controls.Length + 1);
Controls[Controls.Length - 1] = new MyControls(ControlCollection[i]);
Controls[Controls.Length - 1].SaveFormating();
ModifyControls(ControlCollection[i].Controls);
}
}
}
Thanks and Regards
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
Greetings Amar,
If you look at how the MenuStrip control works you will notice that it houses a different type of collection, the ToolStripItemCollection in its MenuStrip.Items property. You need to iterate each ToolStripMenuItem in that collection to get its children.
After that, the ToolStripMenuItem has another ToolStripItemCollection in it's DropDownItems property, you now need to iterate through this collection to get it's children and so forth... consider the following example:
<br />
void ListControls(Control parentControl)<br />
{<br />
foreach (Control control in parentControl.Controls)<br />
{<br />
MessageBox.Show("Control Type : " + control.GetType().ToString() + "\n" +<br />
"Has Children : " + (control.Controls.Count > 0 ? "Yes" : "No") + "\n");<br />
<br />
if (control.Controls.Count > 0)<br />
{<br />
this.ListControls(control);<br />
}<br />
<br />
if (control.GetType() == typeof(MenuStrip))<br />
{<br />
foreach (ToolStripMenuItem toolStripMenuItem in ((MenuStrip)control).Items)<br />
{<br />
MessageBox.Show("---> Menu Strip '" + ((MenuStrip)control).Text + "' has '" + toolStripMenuItem.Text + "' as a child item.");<br />
if (toolStripMenuItem.DropDownItems.Count > 0)<br />
{<br />
}<br />
}<br />
}<br />
}<br />
}<br />
Basically, the MenuStrip needs to be treated like a TreeView as it can contain a complex hierarchy. I hope this helps... Have a great weekend!
Fernando Mendes
Senior .NET Developer, Architect
|
|
|
|
|
thanks for the help
Amar Chaudhary
It is Good to be Important but!
it is more Important to be Good
|
|
|
|
|
In my application I need to use telnet to execute some commands so please help me to this.
How to connect to telnet and how to execute the commands in c#.net
Please help me on this
Thanks in advance
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
Check this. http://www.activexperts.com/activsocket/howto/telnet/aspnetc/
|
|
|
|
|
Hope you google before you post question next time
|
|
|
|
|
I use System.Net.Sockets.TcpClient and System.Net.Sockets.NetworkStream.
System.Net.Sockets.TcpClient socket = new System.Net.Sockets.TcpClient ( Host , Port ) ;
socket.NoDelay = true ;
System.Net.Sockets.NetworkStream stream = socket.GetStream() ;
|
|
|
|
|
hi
in my code, i am saying
button.enabled = false;
...
...
...
...
progressbar.performstep();
label.text = "Pass";
button.enabled = true;
the button is grayed out during this, but if i have clicked during this, it takes the click event after "Pass" is displayed.
how do i prevent this? i need an urgent solution. please see if anyone can help me with some suggestion.
thanks.
|
|
|
|
|
What you exactly want button click will be fired after the text chenges to pass because you have enabled the button.
|
|
|
|
|
i am clicking the button before the text changes to pass.
|
|
|
|
|
Hi
In a separate thread, check the messages in application queues parallely.
If any message of button click comes and you are doing "pass" processing work
delete that message from application quese. Size of application queue would be 8.
|
|
|
|
|
Can anyone tell me how I can have a control tht I don't want other classes to inherit?
I have a base class and the child class needs to inherit but I don't want it to inherit one of the comboboxes. I need to delete it.
I tried to go into the designer class and declare protected but it still inherits.
Thank you
Sianny aka Sharny
|
|
|
|
|
Hi,
Make it as a sealed class.
|
|
|
|
|
i suppose use non abstract class but not sure
|
|
|
|
|
No. A non abstract class is just a class that can be instantiated. The answer to this is to make the class sealed so that it cannot be inherited from.
public sealed class CannotBeInherited
{
}
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
How to copy a file to a different folder?
FileInfo[] fis = d.GetFiles();
foreach (FileInfo fi in fis)
{
fi.CopyTo(Destino + "\\" + fi.Name);
}
or
File.Copy(source,destination);
|
|
|
|
|
Please put your code in <pre> tags so it is readable.
What is fis and files ? From the little bit of context provided, can we assume fis is defined as FileInfo[] ? There are multiple possibilities for files , most of which imply that it is some sort of collection or array. In that case, you won't have a CopyTo method.
There is also not a CopyTo(String, String) method on FileInfo , so is it safe to assume that you actually meant File.Copy(String, String) ?
In either case, both methods only operate on an individual file and all parameters must be a fully qualified file name.
They do the same work and one really isn't any faster than the other, so it all depends on how you are getting the original file.
|
|
|
|
|
I have a form with 3 textbox. when you press Tab then the textbox have a character which was blacken to you put new character. how i do it? Can you help me!
|
|
|
|
|
cam chuong wrote: when you press Tab then the textbox have a character which was blacken to you put new character.
Uhhh, what?? I have no idea what you're talking about. Are you saying that you WANT IT to put a small black box in the textbox when you hit the "Tab" key??
cam chuong wrote: how i do it? Can you help me!
Not unless you describe the problem better.
|
|
|
|
|
can i design my control style and shape as i like
for example like "jetAudio" program bottons
|
|
|
|