|
-
May 1st, 2002, 06:07 PM
#1
Thread Starter
Member
help centering textbox text?
I have imported an ecxel sheet into a textbox, however the columns are off set. the data looks right and the columns are correct but the header row is not aligned with the rest of the column. how can i center each column in the text box? Im using VB.Net
Here is an example:
Name Score Time on Site
john 2 3:45
John should be under "Name
2 should be under "Score"
3:45 should be under "Time on site"
here is the code i use.
Private Sub ViewOrPrint_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = RespTag
'If RespTag = ("January") Then
Dim EXL As New Excel.Application()
Dim January01 As New Excel.Worksheet()
EXL.Application.Visible = False
January01 = EXL.Workbooks.Open("C:\CSRStack\CSR.xls").Worksheets("January01")
EXL.Range("B1:I17").Select()
Dim Cdata As Excel.Range
Cdata = EXL.Selection
Cdata.Sort(Key1:=Cdata.Range("I3"), header:=Excel.XlYesNoGuess.xlYes, order1:=Excel.XlSortOrder.xlDescending) ', Orientation:=Excel.XlSortOrientation.xlSortColumns)
TextBox2.Clear()
Dim iCol, iRow As Integer
For iRow = 1 To 19
For iCol = 1 To 11
TextBox2.AppendText(Cdata(iRow, iCol).value & vbTab)
Next
TextBox2.AppendText(vbCrLf)
Next
EXL.Workbooks.Close()
'End If
End Sub
Last edited by Brian Delphino; May 1st, 2002 at 06:41 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|