Click here to Skip to main content
16,012,468 members

Comments by farout9999 (Top 4 by date)

farout9999 18-Oct-11 4:25am View    
thanks got the value showing up
farout9999 18-Oct-11 2:54am View    
got some problem.. got the value pass to when debugging but it wont show on the textbox the value
farout9999 14-Jul-11 21:32pm View    
sir how can i use this sample code so i could display my data in my grid.. thanks

<pre>
Private Sub PopulateDataGridView()

Dim row0 As String() = {"11/22/1968", "29", "Revolution 9", _
"Beatles", "The Beatles [White Album]"}
Dim row1 As String() = {"1960", "6", "Fools Rush In", _
"Frank Sinatra", "Nice 'N' Easy"}
Dim row2 As String() = {"11/11/1971", "1", "One of These Days", _
"Pink Floyd", "Meddle"}
Dim row3 As String() = {"1988", "7", "Where Is My Mind?", _
"Pixies", "Surfer Rosa"}
Dim row4 As String() = {"5/1981", "9", "Can't Find My Mind", _
"Cramps", "Psychedelic Jungle"}
Dim row5 As String() = {"6/10/2003", "13", _
"Scatterbrain. (As Dead As Leaves.)", _
"Radiohead", "Hail to the Thief"}
Dim row6 As String() = {"6/30/1992", "3", "Dress", "P J Harvey", "Dry"}

With Me.songsDataGridView.Rows
.Add(row0)
.Add(row1)
.Add(row2)
.Add(row3)
.Add(row4)
.Add(row5)
.Add(row6)
End With

With Me.songsDataGridView
.Columns(0).DisplayIndex = 3
.Columns(1).DisplayIndex = 4
.Columns(2).DisplayIndex = 0
.Columns(3).DisplayIndex = 1
.Columns(4).DisplayIndex = 2
End With

End Sub

</pre>
farout9999 14-Jul-11 12:21pm View    
coz i manually set my grid header but when i tried to populate it ..it was change with fieldname

this is my code

<pre>
Private Sub populateGrid()
Dim msg As New clsMessage
Dim ds As New DataSet
Dim connectionString = New SqlConnection(getSqlConnectionString)
Dim strSQL As String
'Dim strColOrderBy As String
'Dim strColumns As String

Try
strSQL = "SELECT categoryid, category FROM category WHERE is_delete <> 1"

Using conn As New SqlConnection(getSqlConnectionString)
conn.Open()
Using adapterLib As New SqlDataAdapter(strSQL, connectionString)
adapterLib.Fill(ds, "category")
'dgMember.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Raised
dgvCategory.DataSource = ds.Tables("category")
End Using
End Using
Catch ex As Exception
msg.setMessage = "Ooops, an unexpected error has been encountered." & Chr(13) & ex.Message
msg.setIcon = MessageBoxIcon.Warning
msg.setButton = MessageBoxButtons.OK
MessageBox.Show(msg.getMessage, "Error", msg.getButton, msg.getIcon)
msg = Nothing
End Try
End Sub
</pre>

did i get it right?