473,569 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Where can I put this string so it is visible to all programs?

I've looked for a 'module' and used the class viewer to put it in there,
but 'Public UserID As String' is still not a globally visible string.
How do I do this please?
Thanks,
Trint

.Net programmer
tr********@hotm ail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
9 1009
"Trint Smith" <tr********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I've looked for a 'module' and used the class viewer to put it in there,
but 'Public UserID As String' is still not a globally visible string.
How do I do this please?
Thanks,
Trint


If you are writing a library, you would typically expose a string that is
gettable and settable via a property.

R.
Nov 20 '05 #2
Modules are a little weird in VB.NET, don't act like they did in vb6 (from
what I've seen, I try to avoid them like the plague).

Anyways, you might want to do

Imports myModule

on top of the classes you want to use it in. Personally, I would use a
Class declaration and call a shared varialble

i.e

public class myClass

public shared UserID as Integer

end class
"Trint Smith" <tr********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I've looked for a 'module' and used the class viewer to put it in there,
but 'Public UserID As String' is still not a globally visible string.
How do I do this please?
Thanks,
Trint

Net programmer
tr********@hotm ail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3
* Trint Smith <tr********@hot mail.com> scripsit:
I've looked for a 'module' and used the class viewer to put it in there,
but 'Public UserID As String' is still not a globally visible string.


What exactly do you mean with "globally"?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
I figured it out...
In VS.NET right click on the project in the solution viewer and select
add> add new item> module> open>
It looks like this of course:

Module Module1

End Module

then just stick it in there so that it looks like this:

Module Module1
Public UserID As String
End Module

And anything can be seen by any program in the project.
Thanks,
Trint
.Net programmer
tr********@hotm ail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5
Shared variable would be just what the guy is looking for, I agree.

"CJ Taylor" <no****@blowgoa ts.com> wrote in message
news:10******** *****@corp.supe rnews.com...
Modules are a little weird in VB.NET, don't act like they did in vb6 (from
what I've seen, I try to avoid them like the plague).

Anyways, you might want to do

Imports myModule

on top of the classes you want to use it in. Personally, I would use a
Class declaration and call a shared varialble

i.e

public class myClass

public shared UserID as Integer

end class
"Trint Smith" <tr********@hot mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
I've looked for a 'module' and used the class viewer to put it in there,
but 'Public UserID As String' is still not a globally visible string.
How do I do this please?
Thanks,
Trint

Net programmer
tr********@hotm ail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 20 '05 #6
But I'll encrourage u to use Shared member variables for this purpose.

"Trint Smith" <tr********@hot mail.com> wrote in message
news:uv******** ******@TK2MSFTN GP10.phx.gbl...
I figured it out...
In VS.NET right click on the project in the solution viewer and select
add> add new item> module> open>
It looks like this of course:

Module Module1

End Module

then just stick it in there so that it looks like this:

Module Module1
Public UserID As String
End Module

And anything can be seen by any program in the project.
Thanks,
Trint
Net programmer
tr********@hotm ail.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #7
* "Abubakar" <em**********@y ahoo.com> scripsit:
But I'll encrourage u to use Shared member variables for this purpose.


.... in a class. Or you can implement the singleton design pattern...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #8
I meant just make some class where he can keep all his shared stuff

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:uE******** ******@TK2MSFTN GP09.phx.gbl...
* "Abubakar" <em**********@y ahoo.com> scripsit:
But I'll encrourage u to use Shared member variables for this purpose.


... in a class. Or you can implement the singleton design pattern...

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #9
* "Abubakar" <em**********@y ahoo.com> scripsit:
I meant just make some class where he can keep all his shared stuff


Yep... That will work too.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1607
by: Glenn Venzke | last post by:
I have several folders on a test web server that are not visible in the directory structures of several programs, including Visual Interdev and Stac ReachOut. All these folders have one thing in common: they are shared. I tried turning sharing off to fix the problem - no good. The only way to make these folders visible to my project is to...
15
2030
by: Lasse Skyum | last post by:
I have my own string class that I'm generally verry fond of compared to std::string. For that same reason I'm trying to improve a little on it. Since manny objects in my project will contain strings of empty size "" I thought it would be a good idea to share en empty string allocation between all uninitialized strings. However I have no...
2
1187
by: Web Team | last post by:
Hi All, I have this code, which I am trying not to replicate many times in my code-behind. Me.img1.Visible = False Me.img1UploadButton.Visible = True Me.pnlImg1Uploader.Visible = True Me.img1Cancel.Visible = True
3
1159
by: Trint Smith | last post by:
I have several strings in my project that I want all programs in the project to be able to see...How do I do that? Thanks, Trint .Net programmer trintsmith@hotmail.com *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
4
1229
by: Trint Smith | last post by:
I did have UserID as 'Dim UserID As String'. Ok, when I made it 'Public UserID As String', in the Public Area of one program and took out all the 'local' declairations of it, even in the other programs that need to see the same value of UserID, UserID was getting the 'UserID is not declaired' message in the other programs. Do I have to put...
16
11526
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images, image N, the panel N becomes visible and all the other invisible.
43
5168
by: Kislay | last post by:
Which of the following is correct regarding the storage of global variables : 1. Global variables exist in a memory area that exists from before the first reference in a program until after the last reference . 2.Global variables exist in the initialized data segment .
4
1729
by: 1230987za | last post by:
Hi, Let's say I have the following class: class foo { public: foo(); void addItem(int item); private:
5
1395
by: sarabonn | last post by:
hallo, I have a function which takes 2 values as input and i want to return that 2 values, so how should write the return statement to return 2 values of String array. I also i should retrieve these values in a button click event. here is my code. public String newop(string userna,string pwd) { ...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.