minus4
Member
- Joined
- Apr 7, 2008
- Messages
- 5
- Programming Experience
- 5-10
hi there, i have running a tablelayout and things are running and work quite well
but i have a problem with text length not fitting into boxes, I.E a telephone number like 000000 / 0000000 will only show 000000 / 00
I like the way that the dataset would let the text be selectable for copying and will also fill the text even if you cant see it, my code is below can someone please guide me as to how i would accomplish the dataset look without actually using a dataset.
many thanks
but i have a problem with text length not fitting into boxes, I.E a telephone number like 000000 / 0000000 will only show 000000 / 00
I like the way that the dataset would let the text be selectable for copying and will also fill the text even if you cant see it, my code is below can someone please guide me as to how i would accomplish the dataset look without actually using a dataset.
many thanks
VB.NET:
Private Sub tabClients_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabClients.Enter
conn = New MySqlConnection()
conn.ConnectionString = My.Settings.mysqlconn
Try
conn.Open()
Catch ex As MySqlException
MessageBox.Show("Database Error: " & ex.Message)
End Try
mysqlstring = "SELECT clientid, business, COALESCE(contact,' ' ) AS contact, COALESCE(ln3,' ' ) AS ln3, COALESCE(telephone, ' ') AS telephone, COALESCE(mobile, ' ') AS mobile FROM clients ORDER BY business"
myCommand.Connection = conn
myCommand.CommandText = mysqlstring
myadapter.SelectCommand = myCommand
mydata = myCommand.ExecuteReader()
tblClients.Controls.Clear()
Dim mycount As New Dbase
Dim myRows As Integer = mycount.clientcount()
tblClients.AutoSize = True
tblClients.Width = 825
tblClients.Height = 10 * myRows
tblClients.BackColor = Color.White
tblClients.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single
ReDim lbusiness(myRows)
ReDim lcontact(myRows)
ReDim llocation(myRows)
ReDim ltelephone(myRows)
ReDim lmobile(myRows)
ReDim mybutton(myRows)
Dim i As Integer = 0
While mydata.Read
i = i + 1
lbusiness(i) = New Label
lcontact(i) = New Label
llocation(i) = New Label
ltelephone(i) = New Label
lmobile(i) = New Label
mybutton(i) = New Button
lbusiness(i).AutoSize = True
lcontact(i).AutoSize = True
llocation(i).AutoSize = True
ltelephone(i).AutoSize = True
lmobile(i).AutoSize = True
mybutton(i).AutoSize = True
tblClients.RowStyles.Add(New RowStyle(SizeType.AutoSize))
lbusiness(i).Name = "lblbusiness" & i
lcontact(i).Name = "lblcontact" & i
llocation(i).Name = "lbllocation" & i
ltelephone(i).Name = "lbltelephone" & i
lmobile(i).Name = "lblmobile" & i
lbusiness(i).Font = New Font("verdana", 8, FontStyle.Regular)
lcontact(i).Font = New Font("verdana", 8, FontStyle.Regular)
llocation(i).Font = New Font("verdana", 8, FontStyle.Regular)
ltelephone(i).Font = New Font("verdana", 8, FontStyle.Regular)
lmobile(i).Font = New Font("verdana", 8, FontStyle.Regular)
lbusiness(i).Text = mydata.GetValue(mydata.GetOrdinal("business"))
lcontact(i).Text = mydata.GetValue(mydata.GetOrdinal("contact"))
llocation(i).Text = mydata.GetValue(mydata.GetOrdinal("ln3"))
ltelephone(i).Text = mydata.GetValue(mydata.GetOrdinal("telephone"))
lmobile(i).Text = mydata.GetValue(mydata.GetOrdinal("mobile"))
'lbusiness(i).Tag = i
tblClients.Controls.Add(lbusiness(i), 0, i)
tblClients.Controls.Add(lcontact(i), 1, i)
tblClients.Controls.Add(llocation(i), 2, i)
tblClients.Controls.Add(ltelephone(i), 3, i)
tblClients.Controls.Add(lmobile(i), 4, i)
mybutton(i).Text = "View / Edit details"
mybutton(i).Tag = mydata.GetValue(mydata.GetOrdinal("clientid"))
mybutton(i).Name = "view" & i
AddHandler mybutton(i).Click, AddressOf clientView
tblClients.Controls.Add(mybutton(i), 5, i)
End While
conn.Dispose()
conn.Close()
End Sub