When To Use Dim Vs Private

Nov 17, 2009

I am pretty new to VB.Net and OOP in general and am picking stuff up every day, but it is so easy to become burnt out with the sheer amount of info. Therefore I am taking it slowly. Yesterday I was reading my book and read that using Dim for class level variables is allowed(if the compiler is set so) but is bad design and I should instead use Private. Dim defaults to private anyway. So my question is where should I use Dim instead of Private?

View 14 Replies


ADVERTISEMENT

VS 2008 Sharing Variables - Private Sub Could Use The Variable Created On Private Sub

Jul 23, 2010

if for example i have two private sub I declared a local variable on private sub a... is there a way that private sub b could use the variable created on private sub a? Im asking because im in a problem in my app were using global variable is not an option to make the long story short

View 5 Replies

What’s The Difference Between Private Sub And Private Function

Dec 14, 2011

I am completely lost on procedures. Whats the difference bewteen Private sub and private function?

View 1 Replies

Calling Private Subs In Another Private Subs?

Jun 15, 2009

I'm trying to call a private sub in another private sub. For example ;

[Code]....

View 13 Replies

Difference Between Public Sub And Private Sub And Private Function And Public Function And Sub And Shared Function?

May 31, 2011

explain me the difference between them? I'm new to visual basic, and I need to know the very basic things in Visual Basic allowing me to become a professional User

View 8 Replies

.net - Using Private Function?

Oct 30, 2010

I am using following code to run a private function.I have two values in my combo box, One and Two and two private functions with the same names, Private Sub One() and Private Sub Two()I want my application to call the function whatever value user choses in the combo box.If One is chosen in the combo box, Private function one should be called.Code is below, that does not work

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim vrValue = ComboBox1.Items(1)

[code]....

View 3 Replies

Calling To A Private Sub

Apr 6, 2009

I have a Form that includes ContextMenuStrip1 and PictureBox called "PicBoxBack".How can I call Private Sub PicBoxBack_MouseClick from the ToolStripMenuItem_Click Procedure??[code]

View 6 Replies

Module Private To Everything But One?

Aug 22, 2010

I have a "Main" module that is sort of the "brain" or "top level" of my project. Basically, I think there are routines that it only should be allowed to call. Some of these routines are in other modules, so I don't know how to make them hidden to everything except the Main module. If the routine is ublic, anything can call it; if it is private then the Main module can't see it. Also the other modules are big enough that I don't feel it would be a good idea to stuff them completely inside my main module. How can I achieve this "private except in one place" functionality?

View 2 Replies

Pass Value In One Private Sub To Another

Nov 9, 2011

I can not for the life of me figure out how I can pass a value from one private sub to another. Been at this for a couple of hours now.

Code:
Private Sub first_one()
Dim test As String
test = "it works"

[Code].....

View 6 Replies

RSA Private Key Encryption?

Aug 10, 2009

I'm looking to use RSA Asymmetric encryption to encrypt some data. I've read this article on the forums with a similar title, but it did not answer my question. What I would like to do is use the private key of an RSA key combination to encrypt (sign?) the data and use the public key to decrypt (verify?), as per this wikipedia article . I would like to use this method because I want people to be able to read the data, but not create it themselves. I've copied the code from Peter Bromberg's article RSA Encryption in .NET Demystified , but always get an exception with the "Bad Key" message. If I use the public key for decryption, it works fine (the opposite of what I want). use the public key for encryption.

View 2 Replies

Sharing A Private Sub?

Jul 10, 2011

how to make projects which span multiple files and classes just fine. I've had big multi-file things working.I've been told explicity that my classes have to be private...yet at the same time I'm supposed to have a main method elsewhere and somehow call a menu in my main working file.I can get the program working perfectly when I do it in a logical manner but I just can't figure out how to call a private sub. I keep getting the error reference to a non-shared member requires an object reference.I've tried breaking the rules a bit and making one initial sub which is public, shared, etc... but all this does is delays the error until it tries to call its first private sub.

View 3 Replies

Use Private Proxy With VB?

Mar 19, 2012

Right now I'm using:

Dim newProxy As New IEProxy
If newProxy.SetProxy(proxyip) Then
....

[code].....

View 2 Replies

VB Equivalent To {get; Private Set;}

May 8, 2009

I don't suppose there is a VB equivalent to a property's {get; private set;} in C#? I get errors if I try to make the Set private (I also need the property to be overridable). Readonly is the closest thing i can think of, but this does not work with my situation (working with NHibernate).

View 15 Replies

.net - Can't Reflect On Private Methods?

Jan 5, 2012

So I created this thread: Invoking Private / Protected Methods Via Reflection From The Same Object Instance (or Base) And we got the problem fixed save for private methods. As this may not be the same issue I thought it may be best to post a different question with the full source. It is still a work in progress but it is functional.

[Code]...

So this class is being inherited by a (so far) empty child class and ProcessStage is being called. Notice that ConfirmFormDataIsValid() sub is private. If you run this it will not find this method. If I change it to protected however it works fine.

View 2 Replies

.net - Create A Signature From Private Key?

Nov 26, 2010

I am trying to create a signature from a private key that i have been provided and a hashed value. I am using DSA and the following code but receive the following error:

Invalid type specified. source mscorlib

The error is thrown on this line: ImportCspBlob(pk)

Private Function key() As String
Dim privatekey As String = "-----BEGIN DSA PRIVATE KEY-----" _
& "Key Data"

[Code]....

View 1 Replies

.net - Friend WithEvents In VB Vs Private In C#

Dec 17, 2009

Who knows, why in vb.net WinForm projects the designer by default use the Friend WithEvents attributes and in C# - private ones.

By ex, in a form.designer.

.cs

private Label Label1;

.vb

Friend WithEvents Label1 as Label;

For WithEvents is more or less clear(for using Handles, apparently). But why Friend in VB and private in C#...

View 4 Replies

Added The New Private Function?

Aug 10, 2011

Basically i have a question how going to added the new private function as highlighted ?

View 14 Replies

C# - Encrypting A Private Key With BouncyCastle?

May 19, 2012

I'm using the .NET version of BouncyCastle, and I have to save a private RSA key to file, obviously encrypted with a password for security reasons.What I'm trying right now is this:

Dim rand As New SecureRandom
Dim arr As Byte() = New Byte(7) {}
rand.NextBytes(arr)

[code].....

But BouncyCastle is thwrowing a NullReferenceException on the last instruction. Since the method is totally undocumented >:( I wonder if any of you know how to use it correctly...

View 1 Replies

Calculations In A Private Function

Jan 27, 2010

i want to add calculations in 1 private function I have a textbox named lbldisplay.text when i enter a number.. the number is shown as a string so.. -private number1 as string when i press the button "+", "*", "-", or "/" the number1 must return into a double. So the number in the textbox is now a double.. so for example i press the + button, and i need to fill in a new number.. but this new number is also a string!

[Code]...

View 2 Replies

Call Function Or Private Sub?

Aug 9, 2010

I design a simple program that has manys sub program, I am trying to call Private sub, but i dont want may program to wait until it get back from that private sub, i want it to conitunie.

like calling Exp2 and the Exp1 countine the other command without waiting to get back from Exp2

Private sub Exp1 ()
...
...
...
Call Exp2

[Code].....

View 3 Replies

Calling Private Sub Using Combobox?

Oct 30, 2010

I am using following code to run a private function. I have two values in my combo box, One and Two and two private functions with the same names, Private Sub One() and Private Sub Two() I want my application to call the function whatever value user choses in the combo box. If One is chosen in the combo box, Private function one should be called. Thanks Code is below, that does not work

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim vrValue = ComboBox1.Items(1)

[code]....

View 1 Replies

Generate Public Private Key?

Apr 12, 2010

How to generate public private key VB.net code...

View 1 Replies

Get Private Sub To Click A Button?

Jul 5, 2009

Is it possible to call a function that can click a button...

What it comes down to is I have 92 buttons on my form and instead of copy/paste or retyping all those into and If/then...

Can I do something like this:

Private Sub Picker
If int = 1 Then
button1.click

[Code].....

View 2 Replies

Get Private Working Set Of A Process

Nov 30, 2009

I want to get the Private Working Set of a process (as it shows in task manager), using the Process Class. I'm able to get the working set /1024, but this number does not match the number I am looking for. Is the Process class capable of doing this?

View 4 Replies

HTTPS Post With Private Key?

Jun 2, 2009

I have a very simple application that posts an XML file to a web service.

ohttp.open("POST", "https://target.web.site")ohttp.send(stringrequest)

Now this works on most workstations, the prompt for the private key is displayed the user presses OK and the XML is passed and a response is received. I have found some client computers that this does not work on. The computer does not display the prompt for the private key. I have been trying to figure out what is suppressing/blocking the prompt for the private key confirmation.

View 1 Replies

Loop - .net For Each Private Variable?

May 10, 2012

I'm working in VB.net and I want to create a generic ToString. is there a way to do a "For Each" in "Me".

[Code]...

View 1 Replies

MVC - Virtual Property To Be Set Private For IDs

Jan 28, 2010

I am trying to use fluent nhibernate in a MVC project. It seems the entities should have properties that are virtual and the set should be private for IDs. I use vb language. So tried using overrideable. It gives an error...

Public Overridable Property DesignId() As Integer
Get
End Get
Private Set(ByVal value As Integer)
End Set
End Property

It says property cannot be overrideable because it has a private accessor.

View 3 Replies

Private And Conference Chat?

Mar 8, 2010

i want to do partially clientserver chat application i have a idea that if user login to server his username and ip address shold detected and send to all the clients and in client list only username should display , ip address is kept hide , when user clicks any client it should connect directly to that client instead of server so that server load will be less only for conference chat we should use server?

View 2 Replies

Private TraceStream As New IO.StreamWriter?

Oct 3, 2009

I have an issue: I'd like to create a directory Private traceStream As New IO.StreamWriter(is how I open my file to write to. Is there a way to create a directory before this prive tracestream is called?

Directory.CreateDirectory(in the form_load does not work. An exception pops up saying directory can't be found.

View 5 Replies

Tell Program To Go Back To A Private Sub?

Jan 18, 2009

I have a code for a tic-tac-toe game, where there's basically 3 private subs. There's a sub called "userturn" that handles the button clicks on the board. The next sub is "compturn" which controls where the computer moves. The last one is "checkforwin" which does what it says.

Here's my problem:

At the end of the "userturn" sub, I have a line that says, "compturn()" to tell it to go to the compturn sub. That sub is executed correctly, but when I try to add the line, "userturn()" to go back to the userturn sub, I get this error[code]...

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved