Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am filling a datagrid with info I pulled in from from my database. Everything works like I want it to but one thing. The column size. Is there a way to basically autosize with what info is there.

 

It brings back "Social Distortion" but all I see is "Socia" until I take the mouse to the column line and double click and the column snaps to the end of the text. i wou;ld like it to come up like that automatically.

 

This is my Code

 

Private Sub datagridit(ByVal strCommand As String, ByVal strTable As String)

Dim myDataAD As New OdbcDataAdapter

Dim myConnection As New OdbcConnection(strConnect)

myConnection.Open()

Dim myCommand As New OdbcCommand(strCommand, myConnection)

Dim ds As New DataSet

myDataAD = New OdbcDataAdapter(myCommand)

myDataAD.Fill(ds, strTable)

Me.DataGrid1.DataSource = ds.Tables(strTable)

Me.DataGrid1.RowHeaderWidth = 0

 

myConnection.Close()

myCommand.Dispose()

myDataAD.Dispose()

End Sub

Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...