I’ve not been able to find much information on this.
How do I return database column titles and space column queried data evenly?
I’ve been able to space data using Space() but the records vary in characters so the record data is returned staggered like this:
RS.Read() Returns
==================================================
3942 Associate Description Regular Hours OT Hours
343243543 Associate Description Regular Hours OT Hours
Code
===================================================
Imports MySql.Data.MySqlClient
Imports MySql.Data
MySqlCmd = New MySqlCommand(sql, dbCon)
dbCon.Open()
DR = MySqlCmd.ExecuteReader
While DR.Read
TextBox1.Text = TextBox1.Text & _
DR.Item("DATE") & _
Space(5) & DR.Item("JOB_NUMBER") & _
Space(5) & DR.Item("ASSOCIATE") & _
Space(5) & DR.Item("DESCRIPTION") & _
Space(5) & DR.Item("REGULAR_HOURS") & _
Space(5) & DR.Item("OT_HOURS") & _
vbCrLf & vbCrLf
End While
Thanks in advance for any help.
You might want to look at strings.rset and strings.lset. You will also have to use a monospaced font for your textbox. The more usual approach though would be to use a datagridview rather than a textbox.