Array With Object Names
Jan 30, 2010
I'm having problems regarding using arrays on object names. for example, i have a textbox named txtBox1.text and a array declared as a(2). I what to transfer the value of the textbox to the array using loop.[code]
View 2 Replies
ADVERTISEMENT
Jul 28, 2010
I am trying to create the following program Store in a 1d array a set of 5 place names and in a 2d array the distances between the places. Ensure that the order of the places is the same in both arrays. When the names are places are input the distance between them is displayed. If they are not both in the table a suitable message is displayed
Dim town(1 To 5) As String
Dim Dist(1 To 5, 1 To 5) As Integer
Dim First As Integer
[CODE]......................
I think the best way forward is pass a parameter to the function findnumber.
View 1 Replies
Jun 8, 2009
I have an array of filenames, and an array of files in a directory. I use a for loop in a for loop to check if those files are in that directory. Look at the below code to illustrate my problem. [code]
View 8 Replies
Jul 15, 2011
Is it possible to construct the name of an object (in this case, a Panel control) at runtime?
What I want to do is change the Backcolor of one Panel that is a member of about fifty panels. I can get the string of the name from the Sender in a RadioButton CheckedChanged event. So what I want to do is something like:
PanelName = sender.parent.name & ".BackColor"
PanelName = Color.Red
(I realize that the syntax above is invalid. I'm just using it to try to get the idea across.)
I can do what I need with big, fifty-element Select Case blocks, but the code is so repetitive that I was hoping there was a more elegant way.
View 7 Replies
Apr 10, 2010
For my assignment i need to list all the objects and their names. Surely i can get a list because typing out 150 names seems a bit ?
View 7 Replies
Oct 6, 2008
This is my first post here at Xtreme VB Talk. I just started programming 2 semesters ago. I am currently working on a program but I am having a little trouble with the length. I am trying to take the integer entered in a text box and using it inside the name of another object.
[Code]...
View 5 Replies
Jun 18, 2009
project i'm working on for school. Need to make a grade calculator thing but I'm trying to make my code more efficient.
This is what I have at the moment:
txtID.Text = ListBox1.SelectedIndex
txtFname.Text = namesarr(ListBox1.SelectedIndex, 0)
[code].....
View 8 Replies
Mar 15, 2012
I don't know if I explained this in my title, this is what i want to do. (In VB on a active server page) I have 5 buttons called but1.....but2. Right now I have the following code to make them invisible
but1.Visible=false;
but2.Visible=false;
but3.Visible=false;
but4.Visible=false;
but5.Visible=false,
Is there a way to access the objects by using a string, example
for(i=i;i<6;i++
items("but"+str(i)).visible=false
View 1 Replies
May 2, 2012
I've Created a Table in my Database "T_OPTIONS"
my table looks like this.[code]...
View 3 Replies
Jul 18, 2009
I am trying to view all the properties of this:
Dim IISOBJ = GetObject("IIS://LocalHost/W3SVC/1")
For the life of me I can't figure out how to display all the property names of this object.
View 3 Replies
Mar 2, 2010
I want to write a routine that loads a table (or query) and outputs it to a text file, with the field names in the first row.If I load the data via an adaptor class into a datatable, I can access the field names by something like DataTab.Columns(i).ColumnName.
As I only want to read the data from the table, using SqlDataReader would be more efficient. But how can I then find what the header or column names are? The following code fails with a message that the SqlDataReader class does not have a member called 'Columns ':
Dim sqlCmd As SqlClient.SqlCommand = New SqlCommand(SQL, Connection)
Connection.Open()
Dim Reader As SqlClient.SqlDataReader = sqlCmd.ExecuteReader()
Dim FName0 As String = Reader.Columns(0).ColumnName() '<==FAILS
Is there a way to find the column names of an SqlDataReader object?
View 2 Replies
Oct 31, 2009
What i'm trying to do is to open a dialog box which from there i will be able to select files and their names will go into an array.
View 7 Replies
Sep 1, 2009
I'm trying to create an export Excel/CSV function that will iterate through a custom object and first output the property names and then output the values. I want to use reflection only where necessary so I'm attempting to save the property names when I output the headers and then reuse them to print the values. Is this possible? I'm a little weary of using reflection in a loop but is there a better way?
[Code]...
View 2 Replies
Aug 13, 2010
There are issue with using WebBrowser late bind calls related to object/property names generation.For example:
WebBrowser1.Document.DomDocument.Forms.Myform.mycontrol.Value = "test"
will fail with more than one instance of the WebBrowser control.what actually happen is that mycontrol object become Mycontrol and compiled vb.net application will fail with error
Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType,
String name, Object[] args, String[] paramnames, Boolean[] CopyBack)[code].....
Same code will work with vb6 app with multiple WebBrowser controls
Edit: This code is comipled with: Option Strict Off
View 2 Replies
Jan 29, 2012
what is the meaning of the Ampersand after Boolean in "Result as Boolean"? Also I have seen a question mark after Boolean in some 'Dim' statements. What does that mean?
View 3 Replies
Mar 5, 2012
I m trying to write a program that is mostly dynamic. This program enables the user to read in several inputs (temperature, pressure .) and perform calculations on those inputs. After that the program sends an integer to an analogue output port. The program automatically determines the number and type of the inputs. It also creates something called a variable handle for each input.This is then saved to an array input_handler(0,x). That array is sized this way input_handler(0 to 1 , 0 to 9)
0= handle (integer)
1= value (integer)
The program dynamically creates a button for every input. There also is a button for every mathematical operator. This way the user can create a function by pressing buttons.This function will be saved to a string. That string will look something like this input_handler(1,0)+ input_handler(1,4)/ input_handler(1,3)Well now Im stuck with a string and VB will obviously just print out that string instead of calculating anything. Is there any conversion I can perform so that string becomes the actual array values?
View 8 Replies
Mar 15, 2012
In the following code (Class & Form1), I'm trying to figure out the following:
- Create an array that stores the 'Clients' (first name, last name, account number)
- 'Button List' the array with the (First Name , Last Name , Array Value , Account Balance) [code]
View 4 Replies
Jun 28, 2010
How can i add an array on names in a list box And be able to add and delet name in a listbox ps sence i just fond out .net cant mke control array ill use listbox with an array of names in it
View 2 Replies
Jul 8, 2010
In one program i'm making, I have a little problem.In this application I have 25 button, wich I must have enable or disable everytime.How can I sned a part of name of the button? For example, if I have one array with the values:[bt1, bt2, bt3, bt4, bt5....] witch is the name of each control.Is possible someting similar this? :
array(1).enabled=true
button & array(2).enabled=true
etc...
View 8 Replies
Feb 25, 2011
Here's my json:
{"d":{"key1":"value1",
"key2":"value2"}}
Is there any way of accessing the keys and values (in javascript) in this array without knowing what the keys are?
The reason my json is structured like this is that the webmethod that I'm calling via jquery is returning a dictionary. If it's impossible to work with the above, what do I need to change about the way I'm returning the data?
Here's an outline of my webmethod:
<WebMethod()> _
Public Function Foo(ByVal Input As String) As Dictionary(Of String, String)
Dim Results As New Dictionary(Of String, String)
[Code]....
View 2 Replies
Aug 6, 2010
Here is the structure that I have:
Friend Class StandardFormatFile
Friend fileType As String
Friend numberOfSeries As Integer
[code].....
View 3 Replies
Oct 25, 2011
Code:
'array
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces
'Need to output names 'adapter.Name' to another array for faster access.
'Iteration, slower
[code]....
I would like to put all the network interface names into an array without using iteration (For Each, For i).Is there a way to get the properties ie. 'Name' of an array object and be able to array.getvalue() their names?
View 2 Replies
Nov 2, 2009
I am using a structure array with multiple member names with 2 types. My question is can you single out one of the member names and add its total? kinda like this...
HTML Code:
structure structureName
dim a as string
dim b as double
dim c as double
[code].....
View 2 Replies
Mar 5, 2012
I am working on my first VB application and have run into a problem. I am trying to loop through some data and displaying them in labels. I am using a for-each loop but end up with different row with the same labelname. What I would like to do, is to assign a number to the labelname (mylabel1, mylabel2,...), but I can´t figure out how, and I cant find anything online that will work. Here are some of the code that I have made, where I could use a solution to my problem...
[Code]...
View 9 Replies
Jun 14, 2011
I didn't think it fair to post a comment on Fredrik Mörk's answer in this 2 year old post, so I thought I'd just ask it as a new question instead..NB: This is not a critiscm of the answer in any way, I'm simply trying to understand this all before delving into memory management / the marshal class.
In that answer, the function GetByteArray allocates memory to each object within the given array, within a loop.Would the GetByteArray function on the aforementioned post have benefited at all from allocating memory for the total size of the provided array:
Dim arrayBufferPtr = Marshal.AllocHGlobal(Marshal.SizeOf(<arrayElement>) * <array>.Count)
I just wonder if allocating the memory, as shown in the answer, causes any kind of fragmentation? Assuming there may be fragmentation, would there be much of an impact to be concerned with? Would allocating the memory in the way I've shown force you to call IntPtr.ToInt## to obtain pointer offsets from the overall allocation pointer, and therefore force you to check the underlying architecture to ensure the correct method is used*1 or is there a better way? (ToInt32/ToInt64 depending on x86/64?)
*1 I read elsewhere that calling the wrong IntPtr.ToInt## will cause overflow exceptions. What I mean by that statement is would I use:
Dim anOffsetPtr As New IntPtr(arrayBufferPtr.ToInt## + (loopIndex * <arrayElementSize>))
I've read through a few articles on the VB.Net Marshal class and memory allocation; listed below, but if you know fo any other good articles I'm all ears![URL]..
View 1 Replies
Oct 6, 2010
I'm trying to create a form that accepts names (or any strings) as input and stores them in a object. See attached form sample.Form Image:
Operations: ï Initially the NumericUpDown object on the form should be disabled.The user enters a value (string) in the textbox and clicks the Add button or presses the Enter key to activate that button.The application then stores that name in a List object, and displays the last entry in the Label underneath.The NumericUpDown should become enable after the first entry. The user should be able to move between all the values entered using NumericUpDown.
View 7 Replies
Mar 4, 2012
I am creating a dll with all the functions and subroutines that I use all the time and I decided to create a function that I can pass different types of array to so the function obviously (or not) would have an array of type object. Now I no you can pass any type into an object type but when I pass an integer array into an object array I get an error.
value of type '1-dimensional array of integer' cannot be converted to '1-dimensional array of object' because 'integer' is not a reference type.
Shared Function CompareArray(ByVal FirstArray() As Object, ByVal SecondArray() As Object, Optional ByRef ErrorMessage As String = "") As Boolean
Dim IntArrayOne() As Integer = {1,2,3,4,5} Dim IntArrayTwo() As Integer = {1,2,3,5,6} Dim IsSame As Boolean = False IsSame = CompareArray(IntArrayOne(), IntArrayTwo())
View 2 Replies
Mar 29, 2010
I am having some trouble creating an object array of different object types. Here is what I have so far:
Public Sub New()
Dim b1 As New Book("Book Title 1", "Gold Book Publisher", 1.0, "Bob Jones", "192DJDJD212", "01/02/10")
Dim b2 As New Book("Book Title 2", "Gold Book Publisher", 1.0, "Bob Jones", "192DJDJD212", "01/02/10")
Dim b3 As New Book("Book Title 3", "Gold Book Publisher", 1.0, "Bob Jones", "192DJDJD212", "01/02/10")
[code]....
If I define the array As Book (Public publicationArray(6) As Book) or Magazine (Public publicationArray(6) As Magazine) I am able to access the properties of that class but not both. I think I need to define a type for each array instance but not sure how to do this.
View 5 Replies
Mar 4, 2009
I have an interface that describes an specialized list in my application...
[Code]....
Is there a way to make an interface serializable, or am I going to have to convert each of my objects into a concrete class implementing the interface, and then return that class?
View 2 Replies
Jun 23, 2010
I'm killing myself and dehydrating trying to get this array to sort.I have an array containing directories generated by;Dim Folders() As String = Directory.GetDirectories(RootPath)
I need them to be sorted so they appear like in windows explorer in win7 / vista. -- numerically and alphabetically by folder names.The folder names contain both letters and numbers, sometimes letters only or numbers only.
[Code]...
View 2 Replies