[2005] URGENT: How to use a variable's value from one form in another??
HI Guys!
I rilli need your help on this one. I have to finish my code and i am stuck pretty bad.
I have a combobox in one form in my app. i need to use its selectedindex value in another form in the same app. I am not able to do that..
i tried form1.combobox1.selectedindex but that just returns -1
and i tried to store its value in a public declared integer variable and use that variable in the second form, this returns 0.
Please help me out.. i think i might not know exactly how to make a variable declared in one form available in another form.
thx
Abhilash
Re: [2005] URGENT: How to use a variable's value from one form in another??
vb Code:
private sub btn1_Click(sender as object, e as eventArgs) handkes btn1.click
dim frm as new Form2
frm.textbox1.text = me.comcobox1.selectedIndex
frm.show
end sub
or
in form 2 class
vb Code:
private index as integer = 0
public sub New(value as integer)
index = value
end sub
private sub form_load()
me.textbox1.text = value
end sub
in form 1 class
vb Code:
private sub btn1_Click(sender as object, e as eventArgs) handkes btn1.click
dim frm as new Form2(me.combobox1.selectedIndex)
frm.show
end sub
Re: [2005] URGENT: How to use a variable's value from one form in another??
Re: [2005] URGENT: How to use a variable's value from one form in another??
HI!
thank you very much for your help talkro and andy.. u been very helpful
cheers
Abhilash