VS 2008 Pass An Array Between Private Subs?
Sep 4, 2009I want to use a string array created in a different private sub in another, so I need to pass the array. How do I accomplish this task?
View 2 RepliesI want to use a string array created in a different private sub in another, so I need to pass the array. How do I accomplish this task?
View 2 RepliesI'm trying to call a private sub in another private sub. For example ;
[Code]....
Probably an easy question to answer...I have 9 buttons on my form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
etc. and all do the same thing so how can I merge them into the same sub so i don't have to copy and paste a bunch?
i 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?
If you have a class with a PRIVATE constructor.>>
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim example1 As New ExampleClass[code]......
How do I pass parameters of LINQ DataTables through Functions and Subs
View 1 RepliesI was wondering if there is a way to remove "private subs" from a form. Many times I double-click the wrong button in the form, and that sub which pops up will stay in the code forever, which is making the code more messy.
Another thing is that if I change the name of a button in the buttons properties, the "Private sub button1_click..." in the code will always have the old name. Is there any way to update this name in the code?
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].....
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 RepliesI have an array that I created in a sub with a button. I was wondering how I could use this array in other subs after it has been created. I tried making it public and global, but it didn't work.
View 10 RepliesFurther to:- [URL] I now need to pass an array thus:- HTML
[Code]....
Myarray can be redimentioned. Since I need to pass an OBJECT to the thread how do I get the thread to recognise the passed array?
If I make the following array in a push button event and I want to put those array variables in a class array. How do I do that? I am just beginning to learn about classes in vb.net but I am having problems using classes and arrays.Is there any good tutorials on that subject.
[Code]...
I am currently learning VB.net but for a project I need to create and array and pass it using a property. The data to be passed will be a train's destination, the time its due and the expected time of the train. I was wondering if someone could simplly explain how to first produce an array and then show how to pass it to a custom control
View 1 RepliesC++ DLL MiFare.h has
MIFAREAPI_API unsinged short MIFAREAPICC MF_ReadCardBlock( DWORD dwBlkAdr, DWORD dwRdrKey, DWORD dwKeyAB, DWORD dwRspBufSz, BYTE *pRspBuf );
my decalre in VB is
<DllImport("MifareAPI.dll")> _
Private Shared Function MF_ReadCardBlock(ByVal BlkAdr As ULong, _
ByVal RdrKey As ULong, _
[code]....
but i can't get the correct data?
I am writing an OPC Client in VB.NET (2008) and I am using an OPC wrapper from Graybox. I am having some problems with the data types. I have an Array of String that contains all of the OPC Items that I wish to read from the OPC Server. When I attempt to use the Array of String, Option Strict causes the following compile error message:Error 5 Option Strict On disallows narrowing from type 'System.Array' to type '1-dimensional array of String' in copying the value of 'ByRef' parameter 'ItemIDs' back to the matching argument. How do I pass the Item ID's (all strings) in an array?
View 1 RepliesI have an access database for steel members. Each table has a different type of member, and then in those tables, each size of that member type.
I am about to create a tool that draws these sections when they are selected, but as there are 12 different member types, I don't really want to have 12 different Subs for "Draw" that essentially do the same thing.
I considered polymorphism.. (I think I have it correct)
[code...]
I want to create constructor that can create container with these properties:
1. Only Diameter, in new sub define it round shape.
2. Diameter and Volume.
3. Length and Width (for rectangle shape)
All are double data type, but problem is 2 and 3 are conflict.How to let program know I want to create round shape container or rectangular shape container?
[Code]...
Can a BackgroundWorker call additional subs? In my program I am connectiong to an OPC Server. I am doing some AsynReads, which in themselves don't take anytime. But Once I get the AsyncReadComplete returned, I want to do the AsyncRead right away. Basically I need to Loop them. The problem now is that while it is doing this, Everything is unresponsive, because it is just going through the loop. So to perhaps rephrase the question, If the BackgroundWorker initiates a process (in this case AsyncRed) would the returned AsyncReadComplete be apart of the BackgroundWorker or seperate Thread?
View 7 RepliesThis code was working consistently, but now...This code works on the first pass.Then second pass it just hangs on Code:Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient() for about 2 minutesThen the code will fork for another pass, then fail.....
Code:Imports SystemImports System.TextImports System.Collections.GenericImports System.XmlImports System.Xml.LinqImports System.Net.Sockets
[CODE]....
Basicly I have a set of public subs, (not related to a form), inside a public class, and all of them share a variable. One of the subs, the one called for first gives the variable a value.
When the next sub is called, the variable is null. The data in the variable has been erased as the execution of the prior public sub ended I'm guessing.
I'm almost sure that I've seen this somewhere, but I can't find it anymore. Or maybe I'm imagining it, which would'nt be strange either.
When creating a sub or function and adding parameters used when calling it.
-Is it possible to list the parameters that I can enter when using it somewhere in my code?
E.g.
Public Sub MessageMain(ByVal Message As String, ByVal MessageType As String (List of possible values for MessageType)) Same for example as when you have boolean values in a sub/function. As soon as you use that somewhere in your code intellisense will present you with True/False to select.
I'd like the same for parameters in subs or functions I create and calling them from somewhere in my code. Saves me the trouble of remembering which options are available for those parameters.
Namespace MyClassLib
Public Class MainClass
Public Sub New()
[CODE]...
Is it possible to make it so that the user using the Class Library has to declare a new Instance of MainClass() before using Subs/Functions in Class2 or Class3?
Does the following work in VB 2008 for passing an array to a function:
Public Function functionname(ByVal array1() As Short, ByVal array2() as Short) As Short
Also, can ByRef be used in place of ByVal?
I have 2 arrays X(n) and Y(n) where n can vary programmatically, no set value. I want to pass these two arrays between two subroutines.
Sub sub1()
...
call sub2(X,Y,n)
end sub
sub sub2(x,y,n)
...
end sub
I want to know how to prepare the arrays for the "call sub2" and how to extract the arrays in "sub2".
i have collection of data in an array. i need to pass it to web service as an array. how can i do that?
View 2 RepliesI have a VC++ DLL, which returns the sum of two long double values, passed as one dimensional array?l the right syntax to pass array to this dll from vb.net
currently, my code snippet is as follows: DllClass.vb
Imports System
Imports System.Collections.Generic
[code].....
I want to pass the entire array to the next function[code]...
View 3 Repliesi got the output of my project and it is displayed in the RT BOX and saved locally.. the values are stored as arrays.. the RT Box will display three values time, conc and preconc.the time, conc and preconc values are stored as arrays. my problem is, i should pass this values to the next form FORM2.VB.. and display the values in a graphical format.how to pass these arrays from one form to other??
View 1 Replieshow can u pass your array to another form
like example
FORM2
public test(2) as string
test(0) = "test1"
[Code]....
how can i get the value from the array test(0) in form 2 to in my textbox in form 1?
i need to pass array value to a function , here are the details
function MyTest(byval a as integer, byval b() as string)
if b is nothing
msgbox("no array")
[Code]......