Capture Column Value in MessageBox

  • Thread starter Thread starter bobkardell
  • Start date Start date
B

bobkardell

I am new to VB and am trying to learn by creating a flash-card program for
my son.
I have the database connected and I am using it; I have a dataset that is a
table full of my son's words and their definitions; The word is shown in a
text box on the form (works fine) and a button is below that says "click for
defintion." I have a hidden text box on the form to bind the definition
column in the dataset to the form. When the button is clicked I want to
capture the entry in the column associated with the word shown on the form
(naturally the word will change as he scrolls through the form) and display
it in a MessageBox when clicks on the button. I have tried several
different entries, but no luck:
===============
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim textval As String
textval = CardsTableAdapter.GetData(Database1DataSet.cards.definColumn)
MessageBox.Show(textval, ToString)
End Sub
===============
Any help is appreciated
Bob
 
Sorry, but I am still not getting it. The database is already bound to the
form and is already popluated so the first part of the example would not be
necessary - right? The second part of the example refers to DirectCast
which requires a type and I am not sure which type I need to specify. How
do I refer to the value of a text box on a form:
CardsTableAdapter.Dataset.cards.defincolumn?
 
Bob,

In my opinion do you not need that adapter therefore at all. The adapter is
to retrieve the data from the database while as I understood you well, you
have that data all on your datagrid/dataset/datatable.

Cor
 
Back
Top