Loop Versus Array - Retrieving Data?
Oct 7, 2009Can I know which is better when retrieving data?
View 3 RepliesCan I know which is better when retrieving data?
View 3 Replieswhich is better for retrieving data?a loop or an array,
View 2 RepliesI am interested in the pros and cons of data tables and arrays in VB 2010. I programmed decades ago in FORTRAN and used arrays extensively.However, I frequently see data tables in code snippets and don't know when they should be used in lieu of an array.
View 4 RepliesI cut my programming teeth on QBASIC so apologise if I'm a bit behind the times. I wrote a program in QB and I'm trying to convert it to VB.NET. One stumbling block I've hit is the DATA & READ facility, there does'nt appear to be an equivilant in VB. I want to read a list of data into an array using a FOR NEXT loop.
View 13 RepliesI have a 2 dimensional array 'allData(100,2) Is it possible to write the values from this 2-dimensional array to a csv, without using loop?
currently, I have a code but it uses Interop. Unfortunately, I need to just use csv because our servers does not support Interop. Here is my code when using Interop:
xlWorkSheet.Range(rangeCell).Resize(checkedOutItems.Count, 2).Value = allData
Is an ArrayList the same thing as a Structure (i.e. 'array of records')? If they're not the same think, what't the difference?
View 3 Repliesi have used in vba 3 dimensional jagged arrays where i had up to 10000 rows. i am now transferring this to vb.net and learnt that it would be better to work with lists. the dimensions are such as (30, 10000, 30). how would i structure this by using lists?
View 8 RepliesI have been working on a number of card games. Important, of course, is shuffling the deck.I have come up with a few different ways to do this. Currently I do not shuffle, but to deal a card, I lay out the deck in order, selecting a random number between 1 and the number of cards remaining and selecting that card. I then remove that card from the deck so that another card can be picked.There are two main ways to do this, and I am trying to figure out which one is optimal.The first is to have an array of cards. When one card is dealt, a new array is formed with that card missing. I kind of like keeping the array size exactly the size of the deck, but perhaps this is not efficient. So, the first array has length n and the new array after the card is dealt has length n-1. VB.Net makes it simple to change array sizes around like this.
View 1 RepliesI have an array which originally was a Variant array in VB6. Example code in VB6:
ListBoxDrawings.List(X1, Y1) = myArray(X2, Y2)
myArray(A, B) = ListBoxDrawings.List(I, C)
After running it through ArtinSoft's VBUC, its values are handled using GetValue & SetValue.Example code in VB.NET: (ignore conversion to ListView)
ListViewDrawings.Items(X1).SubItems(Y1).Text = CStr(myArray.GetValue(X2, Y2))
myArray.SetValue(ListViewDrawings.Items(I).SubItems(C).Text, A, B)
Since VB.NET doesn't do Variants, I figured out that the array should be typed as a 2D String Array. It seems like there's no reason to use GetValue/SetValue, as the former returns an Object and the latter takes one. This means that I'd have to cast the returned object as a String (Cstr) if I wanted to assign it to a variable, which seems like a pointless extra step that might introduce errors. Also, since the method has lots of overloads, the code might not be as clear. Is there any advantage to using SetValue / GetValue, or should I just consider that an artifact of VBUC converting a Variant, and access the array directly like the original code did?
VB.NET without Get/Set methods:
ListViewDrawings.Items(X1).SubItems(Y1).Text = myArray(X2, Y2)
myArray(A, B) = ListViewDrawings.Items(I).SubItems(C).Text
just want to know what is the difference between these date values?Once some one told me that its difference is server date and client date but not sure which one he meant.Below is 3 type of date currently I'm using and don't know what is the difference between them.
DateTime.Now is from System.DateTime.Now
Now is from Microsoft.VisualBasic.DateAndTime
Today.date is also from System.DateTime
I have a function that is suppost to take a list of strings then split up each part. This is my code
For i As Integer = 1 To UPdata.Count
If InStr(UPdata(i), "!!") Then
Dim DataTBP() As String
Do
DataTBP = UPdata(i).Split("!!")
[Code] .....
One section of UPdata would look something like
ABC#DEF@GHIHSJD!!143#ISJ@PSIODH!!
What I want it to do is firstly separate the lines using !! so i would be left with
ABC#DEF@GHIHSJD
143#ISJ@PSIODH
That part works fine and I am left with an array DataTBP() with 2 values. The strings found above. Its then suppose to extract the part before # for every string left in DataTBP (In my example two) but the function that's meant to do this:
For j As Integer = 0 To UBound(DataTBP)
Dim DataType As String = DataTBP(j)
DataType = DataType.Split("#")
Select Case DataTBP(j)
[Code] .....
Throws me the error
Value of type '1-dimensional array of String' cannot be converted to 'String'.
But I don't know why as DataTBP(j) is a string not an array but a string. I've also tried
For Each a As String In DataTBP
Dim DataType As String = a.Split("#")
Next
It throws the same error
I'm working on a project with a large multidimensional array
resrv(200,12,31,33) it keeps track of information on specific dates within a 200 year range.
What I'm looking to do is save the array to a file so that I can load it again when the program is started.
In VB 6 I used to be able to use a simple for next loop into an open file and load it the same way. It doesn't seem to work the same way with Fthe filestream class in VB.net
I prefer having total control for data access, populating recordsets (now datasets) precisely via a connection string and SQL select (or stored procedure call), etc.Now I wonder whether I really should be using the Data Sources option which just popped up on my radar? From the little I've seen so far, it seems to bind an entire table to a control, whereas most of the time I only need a small number of records from large tables.Before I spend a lot of time investigating, I hope a quick word from you might help me feel happier continuing as I am, or whether I need a kick up the backside towards a Better Way.
View 12 RepliesRetrieving a single word from an array and into a label/textbox?
View 5 RepliesI am in the process of migrating from VB6 to VB 2008. In a pixel grid system I have thousands of cells with about 15 properties each. In VB6 I employed the user-defined datatype "udtCell()" as my array structure. Is this still a good approach - or should I perhaps make Cell a class?
View 2 RepliesI'm using a mysql as my backend database and i'm using the mysqldata adapter for binding the data, i have my data in the database, but the problem is i don't know how to retrieve it, for example when i want to add a record, before i add that record, i want to retrieve the data in my database to trap that the record i'm adding is an existing record
View 11 RepliesI got a weird problem here like I got a site that users can post comments on a friend profile page.Everytime a user post a comment my application sends e-mail to that page owner, you know to inform for a new posted comment on his/her profile page.The problem is I want to stop the application from sending email if that user has just recently posted a comment say like 5 hours ago/earlier.Here is the function I use that would try to check it:
[Code]...
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
[Code].....
how do we connect database in access after con.Close() since we do all operation after the con.Close() and works properly.
I have MSaccess database.I have 2 tables 1) CUSTOMER TABLE=----CUSTOMER ID-Primary --AUTO NUMBER2) ORDER TABLE =----(CUSTOMER ID--Foreign KEY) Now From the front end using VB.net I have an page in which if i enter Customer details and press button add .I have to INSERT into values into CUSTOMER TABLE and I Also at the same time INSERT into ORDER TABLE with this CUSTOMER ID which i generated now.How is it possibl
View 13 RepliesI have a code here which is to insert values in both the tables which has Relationship.[code]...
View 4 RepliesI have this XML:
<root>
<data name="lnkViewResultResource1.Text" xml:space="preserve">
<value>bekijk de resultaten</value>
</data>
[code]...
But, unfortunately, it is not working, it is not getting anything.
I'm using two textbox's to enter text and retrieve the data and then show that data in a datagridview.Here is my
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
[code].....
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim intaccount As Integer
Try
[Code]...
I am using two textboxes, one for roll number and the other for the corresponding roll number.
And I am using 4 command Buttons
Move First
Move Previous
Move Next
[Code].....
I am trying to retrieve the data in a DataGridView and display it in a RichTextBox.
[Code]...
This pulls the data from the first row only though, i want to be able to pull the information form each row and display it on a new line? So if there are 8 rows there will be 8 lines of text with the same values as set in the DataGridView?
I have created a .xsd dataset using the visual studio installed template ->DataSet. nothing programmitcally rather it was using the toolbox and creating various DataTable. how do I retrieve the data once it is assigned programmitcally.
View 2 RepliesI'm making a timer program, that I want to be able to store "unlimited" timer profiles, that someone can load and use. Now I've created a form that you fill with data, which then gets saved to a .xml file in a pre-defined directory. I'm now working on some sort of code that will:
1. Search the directory for .xml files
2. Find any .xml files and convert names to strings
3. Store the strings in a dropdown menu, so that when one is chosen, it loads that profile.
I think I have 1 down:
System.IO.Directory.GetFiles("C:Simple Timer")
Dim di As DirectoryInfo
di = New DirectoryInfo("C:Simple Timer")
di.GetFiles("*.xml")
Below is my code for login page I would like to show login user detail on home. For login my code works properly but does not show currently login user show following error "NO data exists for column/row".
[/CODE]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click
RetrieveUserPass()
End Sub
[code]...
I Want to Display Content of Database Into TextBox,i.e. i have column named "Ename" in "EMP" table of database1 ,now i want to display "Ename" in TextBox of my form , so, how can i do this ?
View 11 RepliesI am interested in making a simple budget program that retrieves current transactions from my bank account and categorizes them appropriately. Is the proper way to do this:
1)Automatically log into the website
2)Read and parse the data
3)Place in correct category?
Is there anything special I would need to do when handling the login/password or should I just do this manually?I'm assuming that is how popular prgrams like Quicken do it.