Board index » Visual Studio » Simplest Issue

Simplest Issue

Visual Studio99
Is driving me nuts



In module 1....



Public pricing1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"

MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

MsgBox(price1)

End Sub



The message box in the module produces the string.



The message box in the event procedure shows it is empty.



I also have noticed when I try to format a string not declared in a module

it says "object reference to a non shared member requires an object

reference."



I tried sharing the sub in teh module and it wont allow that.



Modules are all about sharing......



anyone have ideas?


-
 

Re:Simplest Issue

ehh

Public pricing1 as String

MsgBox(price1)



have a look at the names



and try giving it a value

in your module :

Public price1 As New String("test")



"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>wrote in message

Quote
Is driving me nuts



In module 1....



Public pricing1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"

MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

MsgBox(price1)

End Sub



The message box in the module produces the string.



The message box in the event procedure shows it is empty.



I also have noticed when I try to format a string not declared in a module

it says "object reference to a non shared member requires an object

reference."



I tried sharing the sub in teh module and it wont allow that.



Modules are all about sharing......



anyone have ideas?









-

Re:Simplest Issue

The form procedure should read:



Sub GetPricing

getprice1

msgBox(price1)

End Sub



Sorry about that typing on the fly.



"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>wrote in message

Quote
Is driving me nuts



In module 1....



Public pricing1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"

MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

MsgBox(price1)

End Sub



The message box in the module produces the string.



The message box in the event procedure shows it is empty.



I also have noticed when I try to format a string not declared in a module

it says "object reference to a non shared member requires an object

reference."



I tried sharing the sub in teh module and it wont allow that.



Modules are all about sharing......



anyone have ideas?









-

Re:Simplest Issue

"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>schrieb

Quote
Is driving me nuts



In module 1....



Public pricing1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"



price1 is not defined. Do you use Option Strict, or at least Option

Explicit?



Quote
MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

MsgBox(price1)

End Sub



The message box in the module produces the string.



The message box in the event procedure shows it is empty.



Resolved to the same variable? Right-click on variable name in the event

handler and select "go to definition". Same in the Msgbox line in the

module.



Quote
I also have noticed when I try to format a string not declared in a

module it says "object reference to a non shared member requires an

object reference."



Right.



Quote
I tried sharing the sub in teh module and it wont allow that.



Modules are all about sharing......



Yes, everything in a module is implicitly declared as shared.





--

Armin



www.plig.net/nnq/nquote.html">www.plig.net/nnq/nquote.html

www.netmeister.org/news/learn2quote.html">www.netmeister.org/news/learn2quote.html



-

Re:Simplest Issue

Scor,



Not really sure how this will work unless you declare price1 at the module

level for instance



Module mystuff

Public price1 As String



Public Sub getPrice1

price1="100"

End Sub

End Module



In the from:



Public Class myFrom

Inherits System.Windows.Forms.Fom



Sub getPricing

mystuff.getPrice1() 'Note mystuff. is not necessary but adds to

readability

Msgbox(mystuff.price1)

End Sub

End Class





"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>wrote in message

Quote
Is driving me nuts



In module 1....



Public pricing1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"

MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

MsgBox(price1)

End Sub



The message box in the module produces the string.



The message box in the event procedure shows it is empty.



I also have noticed when I try to format a string not declared in a module

it says "object reference to a non shared member requires an object

reference."



I tried sharing the sub in teh module and it wont allow that.



Modules are all about sharing......



anyone have ideas?









-

Re:Simplest Issue

It should have said:



In module 1....



Public price1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"

MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

getprice1

MsgBox(price1)

End Sub



The question is why the value shows in the message box of the sub in the

module but not in the message box of the form.



Armin and Solex the headers for your response came on my server but not the

text of your message. Please repost and thanks.



"EricJ" <ericRéMoVe@ThiSomnipack.be>wrote in message

Quote
ehh

Public pricing1 as String

MsgBox(price1)



have a look at the names



and try giving it a value

in your module :

Public price1 As New String("test")



"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>wrote in

message

news:u9DPg6$vDHA.1788@tk2msftngp13.phx.gbl...

>Is driving me nuts

>

>In module 1....

>

>Public pricing1 as String

>

>Sub getPrice1

>'do this to get price 1

>price1 = "100"

>MsgBox(price1)

>End Sub

>

>in the event procedure of the form

>

>Sub getPricing

>MsgBox(price1)

>End Sub

>

>The message box in the module produces the string.

>

>The message box in the event procedure shows it is empty.

>

>I also have noticed when I try to format a string not declared in a

module

>it says "object reference to a non shared member requires an object

>reference."

>

>I tried sharing the sub in teh module and it wont allow that.

>

>Modules are all about sharing......

>

>anyone have ideas?

>

>









-

Re:Simplest Issue

Here is the repost:



Scor,



Not really sure how this will work unless you declare price1 at the module

level for instance



Module mystuff

Public price1 As String



Public Sub getPrice1

price1="100"

End Sub

End Module



In the from:



Public Class myFrom

Inherits System.Windows.Forms.Fom



Sub getPricing

mystuff.getPrice1() 'Note mystuff. is not necessary but adds to

readability

Msgbox(mystuff.price1)

End Sub

End Class



"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>wrote in message

Quote
It should have said:



In module 1....



Public price1 as String



Sub getPrice1

'do this to get price 1

price1 = "100"

MsgBox(price1)

End Sub



in the event procedure of the form



Sub getPricing

getprice1

MsgBox(price1)

End Sub



The question is why the value shows in the message box of the sub in the

module but not in the message box of the form.



Armin and Solex the headers for your response came on my server but not

the

text of your message. Please repost and thanks.



"EricJ" <ericRéMoVe@ThiSomnipack.be>wrote in message

news:3fd8955a$0$295$ba620e4c@reader5.news.skynet.be...

>ehh

>Public pricing1 as String

>MsgBox(price1)

>

>have a look at the names

>

>and try giving it a value

>in your module :

>Public price1 As New String("test")

>

>"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com>wrote in

message

>news:u9DPg6$vDHA.1788@tk2msftngp13.phx.gbl...

>>Is driving me nuts

>>

>>In module 1....

>>

>>Public pricing1 as String

>>

>>Sub getPrice1

>>'do this to get price 1

>>price1 = "100"

>>MsgBox(price1)

>>End Sub

>>

>>in the event procedure of the form

>>

>>Sub getPricing

>>MsgBox(price1)

>>End Sub

>>

>>The message box in the module produces the string.

>>

>>The message box in the event procedure shows it is empty.

>>

>>I also have noticed when I try to format a string not declared in a

module

>>it says "object reference to a non shared member requires an object

>>reference."

>>

>>I tried sharing the sub in teh module and it wont allow that.

>>

>>Modules are all about sharing......

>>

>>anyone have ideas?

>>

>>

>

>









-