|
How can I set the values for items that i've added in a comboBox? I've tryed this:
comboBox1.Items.Add("Item1");
comboBox1.SelectedItem = "Item1";
comboBox1.SelectedValue = 5;
but it doesn't work.
|
|
|
|
|
Hi,
what I normally do is that i create a class that will represent an item in the combobox. The combobox uses the ToString() method if you add an object to it. So i propose something like this for you:
<br />
class ComboBoxItem {<br />
<br />
private string sText = null;<br />
private int iValue = 0;<br />
<br />
public ComboBoxItem(string sText, int iValue) {<br />
this.sText = sText;<br />
this.iValue = iValue;<br />
}<br />
<br />
public string Text { get { return this.sText; } }<br />
public int Value { get { return this.iValue; } }<br />
<br />
public override ToString() {<br />
return this.sText;<br />
}<br />
<br />
<br />
}<br />
now you can do something like this:
<br />
comboBox1.Items.Add(new ComboBoxItem("Item1", 5));<br />
and to retrieve the selected value you do that:
<br />
int iSelectedValue = ( (ComboBoxItem) (comboBox1.SelectedItem)).Value<br />
Hope this helps (don't hesitate to ask again if not).
Regards
Sebastian
P.S.: Does somebody know how to do tabs inside the code? (when posting for codeproject)
-- modified at 7:54 Tuesday 13th June, 2006
|
|
|
|
|
|
I have a problem, but i can't see an solution
on Form1 I have 2 Fields from Table 1.
the user fills in the 2 Fields.. and presses the button.
now.. underneath the button there should be some query wich compares the data from a second table that has the 2 fields but also a third.
this should be filled out in the second form and this 3 field should be a increment.
so....
in the first form the user fills in 10000 AD
then press the button
the application checks in the second table to the first 2 values. (10000 AD) and check wich 3 third value is following up.. 18 as example.
my next problem is:
he now should take the first 2 values again and read in the first table wich partner/relatieve of some kind is in this data row.
this value he also should put in a textfield.. and when saved.. this value is put in the second table..
really hope you guys could help me.
i use visual C# 2005 and access database
|
|
|
|
|
hi..
i have a richtextbox in which im displaying some messages, i want to change the color of some text . is there any way to that ?
thanx
|
|
|
|
|
Use:
this.richTextBox1.Select(0, 5);
this.richTextBox1.SelectionColor = Color.Red;
|
|
|
|
|
Hi there am using a javascript to display a timer while running the process but earlier was using input value but now i need it to start while on button click i have the javascript but i need to know how to make it run in c#, pls find the code snippet below.
function convertClickHandle(){if(Form1.<b>button1</b>.<b>click</b>='30') {clock(); return true; }else{ lblMessage.innerText = 'ERROR';return false;}}");
i need to know how to start the timer in the button click in form1.i need help on function to start timer on button click event pls do the need ful.
Regards
ybasha
|
|
|
|
|
hi,
iv want to create a windows application.... with a form containing 2 simple text boxes... my requirement is tat when i give the url of a .asmx file (something like http://localhost/Sample/Test.asmx) in the first text box....... all the web methods it contains has to get populated in the second text box..... tat' it.....
can this be done.... if so how should i proceed....
thanks and regards,
Damodar
|
|
|
|
|
It can be done. You can read the WSDL yourself. I also think that System.Web.Services.Discovery namespace has some classes for reading web service code. I'm not exactly sure of that though since I've never done it myself.
Logifusion[^]
|
|
|
|
|
hi,
thanks.... can u tell me as to
how to get the local path of a virtual
directory just by giving the URL of any
of the .asmx file it contains???
regards
Damodar
|
|
|
|
|
Umm, well if you're writing the code inside the service, just use the Server property. But to do it from outside would be a pretty considerable breach of security.
Logifusion[^]
|
|
|
|
|
hi,
sorry im very much new to c#.net .... can u please elaborate me on the first reply you've given....?????
how do i use the System.Web.Services.Discovery namespace....and proceed to get the list of all web methods in a given .asmx url....tat is something like (http://localhost/BIRMWS/Intray.asmx)
regards,
damodar
-- modified at 1:53 Thursday 15th June, 2006
|
|
|
|
|
Well, I've never done it myself, so I can't tell you how. But, if I were you, the first thing I'd start with is the wsdl tool. You can use it to build a proxy to talk to a web service. I know that the underlying classes used to create the proxy have been exposed because I've seen people making their own proxies before. All I can do is point you in a direction that you can start researching. What you really should try is first using the WSDL command-line tool to see what it does. Then maybe try reading the WSDL file yourself. You should be able to extract the information you need from the WSDL. Whether or not there are some helper classes out there for it, I'm not sure.
Logifusion[^]
|
|
|
|
|
im showing a nonmodal dialog when in my button1 click event in form1
button1_Click(object sender, System.EventArgs e)
{
Formshow myForm = newFormshow ();
myForm.Show();
}
how do i get values from myForm and how do i close it?
regards pauline
|
|
|
|
|
Hi Pauline,
there are several possibilities to do what you want. If you a have a reference to Form1 in FormShow than you could write a method within form1 that will be called by FormShow.
DialogResult is a property of each Form so you can set DialogResultof FormShow manually and obtain its value within Form1 (if you have a reference to FormShow)
Hope this helps (don't hesitate to ask again if not)
Regards
Sebastian
|
|
|
|
|
u can use timer to hide myform sfter certain period of time
and can access public members values of myform in form1
rahul
|
|
|
|
|
Hi,
How can we set the data type of a specific column in the DataGridView?
If anyone have any idea. Please! let me to know.
With Thanks.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi,
I'm a C# newy, coming from VC++ world... and I think I need a little help.
I have a common header file, where a couple of enums are defined, which is used by multiple dlls.
I have a little C# interface that I use as a test tool. I would like to access one of the enum type defined in the header file from my C# interface.
I read a couple of articles/messages/etc already that tell it is not possible to link directly from C# to a header file (no include in C#).
I would like to avoid having to redefine the enum in the interface though. If the enum changes I would like to change it only in the header file used by the different dlls and interfaces.
Is there a way?
Any help/comment will be highly appreciated
|
|
|
|
|
I don't know much about enum in C++.
If you want to use your C++ code in C#, then the best way is to convert / recompile your code to Managed C++. Then you can use it from C#.
Unmanaged C++ -> Managed C++ -> C#.
|
|
|
|
|
I have an problem in datagrud. I've just load a database into datagrid and i want to create a button search to search data in this datagrid.how can i do it?can you help me?
Thanks!!
I'm live in Viet Nam,thereforce i don't write enghlish very well.
|
|
|
|
|
hi
could i ask you how you fill the datagrid
i mean what is the datasource ?? it is dataset ??
Tamimi - Code
|
|
|
|
|
yes, that i mean.
thank for your reply.
holp to recive your answer soon
|
|
|
|
|
i'm forgotten .i'm really sorry
cfx_9850gb
|
|
|
|
|
hi
how can I transparent flash object in vs2003???
thanks
Salmani
|
|
|
|
|
i have two forms ,form1 and form2
and in my form1 i have a button and in the button click event i have the code
Form2 f = new Form2();
f.Show();
my form2 shows
when i want to change something in form1 i should be able to,because currently i can only work with form2 bcause it is active (has focus) and when i give focus to Parent form (form1) the child form (form2) should not be minimized
regards pauline
|
|
|
|