By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,375 Members | 1,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,375 IT Pros & Developers. It's quick & easy.

VB.NET Unable passing String value

P: n/a
I created 2 forms, A and B using VB.NET 2003

in A, the codes are :
==========================
public AsName as string
public AsPrice as double

public sub setValue(ByVal sname as string, ByVal price as double)
AsName = sname
AsPrice = price
end sub

private sub button0_click(...)
Dim frm as B
B.setParent(Me)
B.showDialog()
MsgBox(AsName) 'give me empty value, it should have value ***
MsgBox(AsPrice) 'give me empty value, it should have value ***
end sub
==========================

in B, the codes are :
==========================
public frmParent as A

public sub setParent(ByRef s as A)
frmParent = s
end sub

private sub button1_click(...)
frmParent.setValue("ddd",99.99) 'A values disappear once the B
closed
close()
end sub

private sub B_activated(...)
frmParent.setValue("ddd",99.99) 'A values maintained correct once
the B closed
close()
end sub

==========================

When I using F8 to trace... I found that, although the codes in
B_activated and button1_click are the same, but their behavior looks
different. B_activated provide me the correct output when I return to
A, but button1_click provide me wrong output.

During button1_click, when B is opening, the values(AsName,AsPrice) in
A are correct; Once B is closed, the values(AsName,AsPrice) in A will
automatic become empty and zero.

Anybody help? Because I need to pass the values within forms
frequently, but I have this problem? Any solution? Is this problem
solved in Service Pack already?

Urgent.. Thank You.

Nov 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

I have not had any problems passing values between forms.
Usually I add a public property to a form for passing a value. In your code
I do not see where you ever call setvalue to give asname and asprice a
value.

Ken
---------------
"o1j2m3" <o1****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I created 2 forms, A and B using VB.NET 2003

in A, the codes are :
==========================
public AsName as string
public AsPrice as double

public sub setValue(ByVal sname as string, ByVal price as double)
AsName = sname
AsPrice = price
end sub

private sub button0_click(...)
Dim frm as B
B.setParent(Me)
B.showDialog()
MsgBox(AsName) 'give me empty value, it should have value ***
MsgBox(AsPrice) 'give me empty value, it should have value ***
end sub
==========================

in B, the codes are :
==========================
public frmParent as A

public sub setParent(ByRef s as A)
frmParent = s
end sub

private sub button1_click(...)
frmParent.setValue("ddd",99.99) 'A values disappear once the B
closed
close()
end sub

private sub B_activated(...)
frmParent.setValue("ddd",99.99) 'A values maintained correct once
the B closed
close()
end sub

==========================

When I using F8 to trace... I found that, although the codes in
B_activated and button1_click are the same, but their behavior looks
different. B_activated provide me the correct output when I return to
A, but button1_click provide me wrong output.

During button1_click, when B is opening, the values(AsName,AsPrice) in
A are correct; Once B is closed, the values(AsName,AsPrice) in A will
automatic become empty and zero.

Anybody help? Because I need to pass the values within forms
frequently, but I have this problem? Any solution? Is this problem
solved in Service Pack already?

Urgent.. Thank You.

Nov 23 '05 #2

P: n/a
frmParent.setValue("ddd",99.99)

this is the code I pass values :)

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.