Hi all, New to VB programming and am attempting a small database project.?

Endeavoring to take data from the text record and area it right into a structure.Any help could be greatly treasured.Thanks!
Signal:
Selection Strict On
Imports Method.IO

Public Class Form1
Framework Employee
Dim Name, Deal with, SSN As String, MOST OF US As String
Dim Hours, Price, Gross, Taxes, SSW, Online As String
End Structure

Dim ename() Since Employee, aryTextFile() As String

Individual Sub btnTest_Click(ByVal sender Since System.Object, ByVal electronic As Procedure.EventArgs) Addresses btnTest.Click

Dim str Since String(), we As Integer
Dim inF Since New StreamReader(“payroll.txt”)
ReDim ename(i)

Accomplish Until inF.Look = -1
str = inF.ReadLine.Split(CChar(vbTab))
ename(i).Brand = str(0):ename(i).Deal with = str(1)
ename(i).SSN = str(2):ename(i).MOST OF US = str(3):ename(i).Working hours = str(4)
ename(i).Price = str(5):ename(i).Yucky = str(6):ename(i).Taxes = str(7)
ename(i).SSW = str(8):ename(i).Online = str(9)
lsbTest.Items.Add(ename(i).Brand & ename(i).Deal with & ename(i).SSN & _
ename(i).MOST OF US & ename(i).Working hours & ename(i).Price & ename(i).Taxes & _
ename(i).SSW & ename(i).Net)
we += 1
Loop
inF.Close()
End Sub
End Class

First you might want to separate your logic out to your method plus call it from the event(click).

You may handle a new txt record like ones doing but utilize a conn, cmd, dataset that may be better.Better is always to use a new XML record as ones database in contrast to txt.VB holders XML Perfectly.

Here’s a website with the connection string:

http://www.codeproject.com/KB/database/connectionstrings.aspx#Text

Upon having it in a dataset, a tapped out dataset could be best, you’ll be able to manipulate this any way you need.

Leave a Reply