What’s The Difference Between Private Sub And Private Function
Dec 14, 2011I am completely lost on procedures. Whats the difference bewteen Private sub and private function?
View 1 RepliesI am completely lost on procedures. Whats the difference bewteen Private sub and private function?
View 1 Repliesexplain 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 RepliesWhat is the difference between Private Sub /private Function / Private Class and to use them?
View 4 Repliesif 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 Repliesdifference between the Dim and Private inside a form class?
View 3 RepliesI always used to define variables like Dim xxxx As yyyyy. In the tutorials I'm looking at though they do Private Const xxxxx As yyyyy. I wonder just what is the difference here? What is the significance of this change? What am I actually doing with 'Dim' and what is this Private Const doing different?
View 12 Repliesgive me a good resource that explains the difference between a Private, Public, Shared Functions/Sub/Variables? I normally use Public for Subs/Functions inside of Modules I call from other parts of the program. But I'd like to get more of an understanding of how and when to use them. I want as little as impact to a system that is running my programs as possible, so i guess the key here is I'm trying to just get more proficient in my coding.
View 8 Repliesi have have a few questions about the syntax of the lan.:
1) What is the 'Get' statement and when do you use it?
2) Whats the difference between public, private, protected etc... when declaring functions and subs.
3) When would you use the overrides property?
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]....
Basically i have a question how going to added the new private function as highlighted ?
View 14 Repliesi 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]...
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].....
I am using visual basic and trying to create function. I am getting this error:
"Argument not specified for parameter '_IsDayRateCheckBox' of private function CalculateParikingCharges(_HoursDecimal As Decimal, _IsDayRateCheckBox As System.Windows.Forms.CheckBox) As Decimal'.
This is the code.
Private Function CalculateParkingCharges(ByVal _HoursDecimal As Decimal, ByVal _IsDayRateCheckBox As CheckBox) As Decimal
This is how I call the function.
Dim HoursDecimal As Decimal
Dim AmountOwedDecimal As Decimal
If Not Decimal.TryParse(HoursTextBox.Text, HoursDecimal) OrElse HoursDecimal < 0D Then
ErrorLabel.Visible = True
HoursTextBox.Focus()
[Code] .....
I am using this function in a module which is called from this event " Public Sub Painting(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)" in the module[code]...
View 1 RepliesI'm trying to make an application that calls a function to create a timer, but I cant use WithEvents or Private inside of a function or sub, Is there any way to do this?
View 5 RepliesI am trying to call this private function, but am missing somthing, anybody point me in the right direction Private Function DL_WebPage(ByVal _URL As String) As String This is what I have tried, but with no success: call DL_webpage But this comes up with an error
View 3 Repliesi made this code
VB.NET
Dim iString As String
If My.Settings.IPBank.Count = 30 Then
MsgBox("You alredy have the maximum amount of IP Addresses stored, delete one to add another.", MsgBoxStyle.Information, "Program Error")
[Code]...
I want it to check all of the items in the my.settings.ipbank which is a stringcollection. Before it adds and if it already exists in my.settings.ipbank then i want it not to add it. But it just adds when i run it. And then once its added it says: "Collection was modified; enumeration operation may not execute." But also before i run it. There is a warning saying: Function 'AddTo_IPBank' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used. Is this something to do with it? I think i have the Next in the wrong place .
I have as sub that is triggered from the file system watcher when the new file is created in spec. directory.I need to call some function to do something with that file. [code]
View 6 Repliesim parsing an xml file using this code Private Function overview2(ByRef filePath As String)Dim reader As XmlTextReader = New XmlTextReader(filePath + "\movieData.xml")
[code]...
it works 80% of the time. What i mean is , i go through each node and when i find the overview node i read the data and send it to a text box. Im doing this for movies on disk. sometimes on certain movies it doesnt find the overview node even though it is there .
How can I create a function from this example:
Private Function CheckForNull(fieldvalue as string) as Boolean
That checks that all my fields are not empty? For example, say I have three fields txtFirstName, txtLastName, and txtAddress. How would I write the function above that would check that these fields were not left empty?
I am cleaning up some code and I have multiple classes that are 99% exactly the same. So my understanding is that my options are...
1. Create a class and all other classes inherit from it and modify it a bit
2. Create an abstract class and all classes inherit from it and modify a bit ** I took this route
3. Create an interface and all classes Implement that interface.
Here is my 'original' class below (the one that all of them look 99% identical). This class is used in an arraylist so I have a listing of all my images from a folder I have searched.
[Code]...
I'm trying to call a private sub in another private sub. For example ;
[Code]....
I have two Close() functions in same class as below:
[Code]...
I can't make difference between public class and private class and friend and protected friend class.
View 1 RepliesIn Visual Studio 2008 I am using :Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long To stop input from occuring during a search-replace operation.
BlockInput(True) ' do not allow input during search and destroy
Dim cursorIcon As Cursor
cursorIcon = Cursor
Cursor.Current = Cursors.WaitCursor
Then setting it to false at the end of the operation. It did not work, so I thought maybe it was because I was calling it from a child window, so I created a function in the mainwindow, and ran it like this:
FrmMain.BlockFrmMainInput()With these functions is the Main window:
[Code]...
It did not solve the problem. I thought maybe it was because I was running under the debugger, so I tried compiling and running it debugger-free, but that did not do any better. I am still getting input when I double-click the mouse on either form.
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 RepliesI 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 RepliesI 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 RepliesI 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].....
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