Click here to Skip to main content
15,915,163 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: DLL Registration Pin
Thomas Krojer3-Aug-10 21:37
Thomas Krojer3-Aug-10 21:37 
Questionregister VB.NET COM dll - regsvr32.exe Pin
devvvy29-Jul-10 22:39
devvvy29-Jul-10 22:39 
AnswerRe: register VB.NET COM dll - regsvr32.exe Pin
Richard MacCutchan29-Jul-10 22:47
mveRichard MacCutchan29-Jul-10 22:47 
GeneralRe: register VB.NET COM dll - regsvr32.exe Pin
devvvy29-Jul-10 23:00
devvvy29-Jul-10 23:00 
GeneralRe: register VB.NET COM dll - regsvr32.exe Pin
Richard MacCutchan29-Jul-10 23:36
mveRichard MacCutchan29-Jul-10 23:36 
AnswerRe: register VB.NET COM dll - regsvr32.exe Pin
Goutam Patra29-Jul-10 23:46
professionalGoutam Patra29-Jul-10 23:46 
GeneralRe: register VB.NET COM dll - regsvr32.exe Pin
devvvy2-Aug-10 15:37
devvvy2-Aug-10 15:37 
QuestionHow do I "find first" and "Find next" from VB 6 in VB 2010 Pin
Jaco Muller29-Jul-10 16:31
Jaco Muller29-Jul-10 16:31 
I use to program in VB 6 for many years. I am now trying to move to VB 2010. I want to be able to connect to an ACCESS database, Add a record, delete a record and edit a record with code (no wizards or other controls). Up to this point a can do all this.

The next step is to be able to find a record based on value for any field. In VB6, I use to use a "find" method to find the first record with that search criteria. I could also find the "next" record for that criteria. (This is to find a record, not to filter the table.)

My code so far is:(I have a MDI form with a child form and then a module where I keep my functions.)
In Form:
Private Sub frmDataEntry_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Folder As String
Folder = My.Application.Info.DirectoryPath
MyDatabaseFile = Folder & "\Data\PartInfo.mdb"

mdiMain.Panel1.Text = "My Data Base File: " & MyDatabaseFile

MySQLPart = "SELECT tblPartMaster.PartMaster_ID, tblPartMaster.PartNo, tblPartMaster.Description, " & _
"tblPartMaster.OEM, tblPartMaster.OEMPartNo, tblPartMaster.LastUsed, tblPartMaster.CurrentCost, " & _
"tblPartMaster.DrawingNo, tblPartMaster.Remarks " & _
"FROM(tblPartMaster) " & _
"ORDER BY tblPartMaster.PartNo;"
DataConnect() ' calls a sub in myFunctions module.



DisableText()
ShowCurrentRecord()
End Sub

Public Sub DataConnect()

'*******************************************************
'*** Make Connection
'*******************************************************
MyConnection.ConnectionString = _
"PROVIDER=MSDataShape;" & _
"Data PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & MyDatabaseFile & ";" & _
"Persist Security " & _
"Info=False"
MyConnection.Open()
MyDataAdapter = New OleDb.OleDbDataAdapter(MySQLPart, MyConnection)
MyCommandBuilder = New OleDb.OleDbCommandBuilder(MyDataAdapter)

MyTable_PartInfo.Reset()

MyDataAdapter.Fill(MyTable_PartInfo)

MyTable_PartInfo.PrimaryKey = New DataColumn() {MyTable_PartInfo.Columns("PartMaster_ID")}
MyTable_PartInfo.Columns("PartMaster_ID").AutoIncrement = True
End Sub


Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
If MyRowPosition < (MyTable_PartInfo.Rows.Count - 1) Then
MyRowPosition = MyRowPosition + 1
End If
ShowCurrentRecord()
End Sub



' to add a record

Private Sub btnControl6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnControl6.Click

Dim DataSetNewRow As DataRow = MyTable_PartInfo.NewRow
DataSetNewRow("PartNo") = txtDataEntry1.Text
DataSetNewRow("Description") = txtDataEntry2.Text
DataSetNewRow("OEM") = txtDataEntry3.Text
DataSetNewRow("OEMPartNo") = txtDataEntry4.Text
If IsDate(txtDataEntry5.Text) Then
DataSetNewRow("LastUsed") = txtDataEntry5.Text
Else
DataSetNewRow("LastUsed") = "01/01/1990"
End If
If IsNumeric(txtDataEntry6.Text) Then
DataSetNewRow("CurrentCost") = txtDataEntry5.Text
Else
DataSetNewRow("CurrentCost") = 0
End If
DataSetNewRow("DrawingNo") = txtDataEntry7.Text
DataSetNewRow("Remarks") = txtDataEntry8.Text
MyTable_PartInfo.Rows.Add(DataSetNewRow)
MyDataAdapter.Update(MyTable_PartInfo)
MsgBox("New Record added to the Database")
DisableText()
MyRowPosition = MyTable_PartInfo.Rows.Count - 1
ShowButtons()
ShowCurrentRecord()
End Sub

How to go to a record based on a search criteria. I want to have a textbox where I can type in a "part number" and a "Find" button. So I type in a number and click the button and the form should display the record.
AnswerRe: How do I "find first" and "Find next" from VB 6 in VB 2010 Pin
Dave Kreskowiak29-Jul-10 18:05
mveDave Kreskowiak29-Jul-10 18:05 
GeneralRe: How do I "find first" and "Find next" from VB 6 in VB 2010 Pin
Jaco Muller29-Jul-10 18:26
Jaco Muller29-Jul-10 18:26 
GeneralRe: How do I "find first" and "Find next" from VB 6 in VB 2010 Pin
Dave Kreskowiak30-Jul-10 8:09
mveDave Kreskowiak30-Jul-10 8:09 
QuestionRegular Expressions Failure Pin
Sonhospa29-Jul-10 15:05
Sonhospa29-Jul-10 15:05 
AnswerRe: Regular Expressions Failure Pin
Dave Kreskowiak29-Jul-10 18:01
mveDave Kreskowiak29-Jul-10 18:01 
GeneralRe: Regular Expressions Failure Pin
Sonhospa29-Jul-10 21:03
Sonhospa29-Jul-10 21:03 
GeneralRe: Regular Expressions Failure Pin
Dave Kreskowiak30-Jul-10 8:11
mveDave Kreskowiak30-Jul-10 8:11 
GeneralRe: Regular Expressions Failure Pin
Sonhospa30-Jul-10 23:43
Sonhospa30-Jul-10 23:43 
AnswerRe: Regular Expressions Failure Pin
Peter_in_278029-Jul-10 18:03
professionalPeter_in_278029-Jul-10 18:03 
GeneralRe: Regular Expressions Failure Pin
Sonhospa29-Jul-10 21:20
Sonhospa29-Jul-10 21:20 
AnswerRe: Regular Expressions Failure Pin
Luc Pattyn29-Jul-10 23:58
sitebuilderLuc Pattyn29-Jul-10 23:58 
NewsPartially Resolved: Regular Expressions Failure Pin
Sonhospa31-Jul-10 0:57
Sonhospa31-Jul-10 0:57 
GeneralRe: Partially Resolved: Regular Expressions Failure Pin
Prerak Patel21-Sep-10 1:56
professionalPrerak Patel21-Sep-10 1:56 
QuestionCrystal Reports - Printing Lables Pin
David Mujica29-Jul-10 8:10
David Mujica29-Jul-10 8:10 
AnswerRe: Crystal Reports - Printing Lables Pin
Steven J Jowett30-Jul-10 0:02
Steven J Jowett30-Jul-10 0:02 
QuestionMime Encoding Pin
Steven J Jowett28-Jul-10 21:59
Steven J Jowett28-Jul-10 21:59 
AnswerRe: Mime Encoding Pin
Eddy Vluggen28-Jul-10 22:31
professionalEddy Vluggen28-Jul-10 22:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.