Click here to Skip to main content
15,916,042 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How can I force a user to enter a string with characters only with no integer from a text box? Pin
waner michaud14-Aug-09 11:41
waner michaud14-Aug-09 11:41 
GeneralRe: How can I force a user to enter a string with characters only with no integer from a text box? Pin
Luc Pattyn14-Aug-09 12:38
sitebuilderLuc Pattyn14-Aug-09 12:38 
Questionpassing values from a windows form to a crystal report Pin
myinstincts14-Aug-09 0:12
myinstincts14-Aug-09 0:12 
AnswerRe: passing values from a windows form to a crystal report Pin
Johan Hakkesteegt14-Aug-09 0:41
Johan Hakkesteegt14-Aug-09 0:41 
GeneralRe: passing values from a windows form to a crystal report Pin
myinstincts14-Aug-09 1:57
myinstincts14-Aug-09 1:57 
GeneralRe: passing values from a windows form to a crystal report Pin
Johan Hakkesteegt14-Aug-09 2:10
Johan Hakkesteegt14-Aug-09 2:10 
GeneralRe: passing values from a windows form to a crystal report Pin
myinstincts14-Aug-09 2:17
myinstincts14-Aug-09 2:17 
GeneralRe: passing values from a windows form to a crystal report Pin
Johan Hakkesteegt14-Aug-09 2:43
Johan Hakkesteegt14-Aug-09 2:43 
Not a big problem. Right now you are storing the data in the DataGrid. All you need to do is store it in a DataTable first (the code will look pretty much the same), and bind the datagrid to this DataTable.

Something like:

Dim BillInfo As DataTable = Nothing
        Dim clmn As DataColumn = Nothing
        Dim rw As DataRow = Nothing

        Try
            BillInfo = New DataTable("DataTable1")
            clmn = New DataColumn("PatientName")
            BillInfo.Columns.Add(clmn)
            clmn = New DataColumn("Address")
            BillInfo.Columns.Add(clmn)
            clmn = New DataColumn("Total")
            BillInfo.Columns.Add(clmn)
            'etc
            rw = BillInfo.NewRow
            rw.Item("PatientName") = YourDataReader.Item("NameOfColumn")
            'Using the name of the column instead of the index number will
            'save you a lot of trouble later on, if you ever want to
            'add fields to your query.
            BillInfo.Rows.Add(rw)
            'etc
            'And then when the DataTable is ready:
            DataGridView1.DataSource = BillInfo
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try


Also, in the code you posted, you are not using a loop with the datareader.

Try something like:

dr1 = cmd1.ExecuteReader()
If dr1.HasRows Then
Do while dr1.read()
rw.Item("PatientName") = dr1.Item("NameOfColumn")
Next
End If


My advice is free, and you may get what you paid for.

GeneralRe: passing values from a windows form to a crystal report Pin
myinstincts14-Aug-09 2:49
myinstincts14-Aug-09 2:49 
AnswerRe: passing values from a windows form to a crystal report Pin
Anubhava Dimri17-Aug-09 0:07
Anubhava Dimri17-Aug-09 0:07 
QuestionBring to Front and Send to back Pin
Anubhava Dimri13-Aug-09 23:55
Anubhava Dimri13-Aug-09 23:55 
AnswerRe: Bring to Front and Send to back Pin
0x3c014-Aug-09 0:17
0x3c014-Aug-09 0:17 
GeneralRe: Bring to Front and Send to back Pin
Coding C#14-Aug-09 2:50
Coding C#14-Aug-09 2:50 
GeneralRe: Bring to Front and Send to back Pin
Anubhava Dimri16-Aug-09 23:48
Anubhava Dimri16-Aug-09 23:48 
QuestionMyObject = New Object memory use Pin
Johan Hakkesteegt13-Aug-09 22:22
Johan Hakkesteegt13-Aug-09 22:22 
AnswerRe: MyObject = New Object memory use Pin
Luc Pattyn14-Aug-09 0:57
sitebuilderLuc Pattyn14-Aug-09 0:57 
GeneralRe: MyObject = New Object memory use Pin
Johan Hakkesteegt14-Aug-09 1:43
Johan Hakkesteegt14-Aug-09 1:43 
GeneralRe: MyObject = New Object memory use Pin
Luc Pattyn14-Aug-09 1:50
sitebuilderLuc Pattyn14-Aug-09 1:50 
GeneralRe: MyObject = New Object memory use Pin
Johan Hakkesteegt14-Aug-09 2:13
Johan Hakkesteegt14-Aug-09 2:13 
GeneralRe: MyObject = New Object memory use Pin
Luc Pattyn14-Aug-09 2:20
sitebuilderLuc Pattyn14-Aug-09 2:20 
QuestionHow can I bring Page x from a TabControl? Pin
waner michaud13-Aug-09 11:03
waner michaud13-Aug-09 11:03 
AnswerRe: How can I bring Page x from a TabControl? [modified] Pin
Henry Minute13-Aug-09 11:24
Henry Minute13-Aug-09 11:24 
GeneralRe: How can I bring Page x from a TabControl? Pin
Luc Pattyn13-Aug-09 11:40
sitebuilderLuc Pattyn13-Aug-09 11:40 
GeneralRe: How can I bring Page x from a TabControl? Pin
Henry Minute13-Aug-09 11:51
Henry Minute13-Aug-09 11:51 
AnswerRe: How can I bring Page x from a TabControl? Pin
Luc Pattyn13-Aug-09 11:41
sitebuilderLuc Pattyn13-Aug-09 11:41 

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.