Click here to Skip to main content
15,921,837 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: updating database through datagrid - HELP PLEASE! Pin
Johan Hakkesteegt24-Oct-08 0:41
Johan Hakkesteegt24-Oct-08 0:41 
QuestionData validation in a textbox Pin
saypokguy23-Oct-08 14:03
saypokguy23-Oct-08 14:03 
AnswerRe: Data validation in a textbox Pin
Rupesh Kumar Swami23-Oct-08 20:50
Rupesh Kumar Swami23-Oct-08 20:50 
AnswerRe: Data validation in a textbox Pin
Wendelius24-Oct-08 8:20
mentorWendelius24-Oct-08 8:20 
Questiontextbox Pin
kewyn23-Oct-08 8:58
kewyn23-Oct-08 8:58 
AnswerRe: textbox Pin
Dave Kreskowiak23-Oct-08 9:06
mveDave Kreskowiak23-Oct-08 9:06 
GeneralRe: textbox Pin
kewyn23-Oct-08 9:19
kewyn23-Oct-08 9:19 
GeneralRe: textbox Pin
Dave Kreskowiak23-Oct-08 10:44
mveDave Kreskowiak23-Oct-08 10:44 
Oh boy, where do I begin...

kewyn wrote:
Me.SqlDataAdapter1().Fill(Me.DataSet2) 'fill the data adapter with the dataset


First, this doesn't do what your comment says it does. It's just the opposite. The SqlDataAdapter fills a dataset with a copy of the record retrieve from the database.

Next, for what your code is implying, you don't need the BindingContext. So remove that line.

In your Button1_Click handler, you're misunderstanding so many concepts, from OOP to Data Sets to navigation in the data. There's just too much material to cover to fit it in a forum post. Simplify this. Just start by getting the data in your dataset shown in a textbox. Nothing more.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' It look like your SQL statement returns a single record set.  This means just one table of records.
    ' You need to enumerate through the DataRow collection of the DataTable object in your DataSet.
    ' Get the individual values from each column in the row and format them for output to a String.
    Dim message As String = String.Empty
    For Each dr As DataRow In DataSet2.Tables(0).Rows
        message = message & String.Format("{0}: {1} {2}", dr("CashierId").ToString, dr("Cashier_Firstname").ToString, dr("Cashier_Lastname").ToString)
    Next
    TextBox1.Text = message
End Sub

Seriously, pickup a book on VB.NET for beginners. That should help you understand the basics of OOP and clear up the misconceptions you have as shown by your code.


A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007, 2008




GeneralRe: textbox Pin
Guffa23-Oct-08 13:58
Guffa23-Oct-08 13:58 
QuestionHow do you get the rectangular coordinates for Bookmarks in Word 2000 / 2003 ? Pin
Tomb42123-Oct-08 8:09
Tomb42123-Oct-08 8:09 
Questiontext box Pin
kewyn23-Oct-08 7:55
kewyn23-Oct-08 7:55 
AnswerRe: text box Pin
Dave Kreskowiak23-Oct-08 8:24
mveDave Kreskowiak23-Oct-08 8:24 
QuestionNeed Despriate Help with LPR printing Pin
Trey549823-Oct-08 7:47
Trey549823-Oct-08 7:47 
AnswerRe: Need Despriate Help with LPR printing Pin
Dave Kreskowiak23-Oct-08 9:03
mveDave Kreskowiak23-Oct-08 9:03 
GeneralRe: Need Despriate Help with LPR printing Pin
Trey549823-Oct-08 9:26
Trey549823-Oct-08 9:26 
QuestionInsert graphic image into PDF Pin
Cory Kimble23-Oct-08 6:34
Cory Kimble23-Oct-08 6:34 
AnswerRe: Insert graphic image into PDF Pin
Dave Kreskowiak23-Oct-08 7:37
mveDave Kreskowiak23-Oct-08 7:37 
QuestionProcess.Start Pin
KreativeKai23-Oct-08 6:30
professionalKreativeKai23-Oct-08 6:30 
AnswerRe: Process.Start Pin
Jon_Boy23-Oct-08 6:39
Jon_Boy23-Oct-08 6:39 
GeneralRe: Process.Start Pin
Jon_Boy23-Oct-08 8:27
Jon_Boy23-Oct-08 8:27 
AnswerRe: Process.Start Pin
Dave Kreskowiak23-Oct-08 7:35
mveDave Kreskowiak23-Oct-08 7:35 
GeneralRe: Process.Start Pin
KreativeKai23-Oct-08 7:50
professionalKreativeKai23-Oct-08 7:50 
GeneralRe: Process.Start Pin
Dave Kreskowiak23-Oct-08 8:02
mveDave Kreskowiak23-Oct-08 8:02 
GeneralRe: Process.Start Pin
KreativeKai23-Oct-08 8:14
professionalKreativeKai23-Oct-08 8:14 
GeneralRe: Process.Start Pin
Dave Kreskowiak23-Oct-08 8:28
mveDave Kreskowiak23-Oct-08 8:28 

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.