Click here to Skip to main content
15,898,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalpicture box Pin
BOREC18-Dec-07 15:48
BOREC18-Dec-07 15:48 
GeneralRe: picture box Pin
Luc Pattyn18-Dec-07 16:14
sitebuilderLuc Pattyn18-Dec-07 16:14 
General... Pin
BOREC18-Dec-07 20:07
BOREC18-Dec-07 20:07 
GeneralRe: ... Pin
Luc Pattyn19-Dec-07 5:10
sitebuilderLuc Pattyn19-Dec-07 5:10 
Questionwhat is this? Pin
hassanasp18-Dec-07 12:49
hassanasp18-Dec-07 12:49 
AnswerRe: what is this? Pin
Colin Angus Mackay18-Dec-07 13:03
Colin Angus Mackay18-Dec-07 13:03 
GeneralDock/float tab pages Pin
cstrader23218-Dec-07 11:01
cstrader23218-Dec-07 11:01 
QuestionLooping through database columns [modified] Pin
craigmg7818-Dec-07 5:55
craigmg7818-Dec-07 5:55 
I have been using a FOR loop to loop through the column indexes in an MS Access table and create a textbox and corresponding label on a form for each column. I am incrementing an index to step through all the columns in the Columns collection for the table. I had expected that looping through the columns this way would loop through the columns from left to right in the table (or possibly loop through in the order that the columns were created.) Unfortunately it seems that the index order is more random than that.

My question is: How can I change the column indexes to my liking OR loop through the columns from left to right using VB.Net? My original code is posted below.

Thanks, friends.

- Craig

DataSetColumnUpperBound = EventsNotifications.Ds_BorrowerGenInfo.Borrower_General_Info.Columns.Count - 1

'Dynamically create textboxes and labels
For TBindex = 2 To DataSetColumnUpperBound
    Dim NewTB As New System.Windows.Forms.TextBox
    Dim NewLbl As New System.Windows.Forms.Label
    TBName = "Textbox" & TBindex
    LblName = "Label" & TBindex
    Me.Controls.Add(NewTB)
    Me.Controls.Add(NewLbl)
    NewTB.Name = TBName
    NewLbl.Name = LblName
    NewTB.Enabled = True
    NewLbl.Enabled = True
    NewTB.Visible = True
    NewLbl.Visible = True
    NewTB.Height = 20
    NewLbl.Height = 20
    NewTB.Width = 420
    NewLbl.Width = 420
    NewTB.Top = 85 + ((TBindex - 2) * 45)
    NewLbl.Top = 70 + ((TBindex - 2) * 45)
    NewTB.Left = 20
    NewLbl.Left = 20
    NewLbl.BackColor = Color.Transparent
    NewTB.Text = EventsNotifications.Ds_BorrowerGenInfo.Borrower_General_Info.Rows(0).Item(TBindex).ToString
    NewLbl.Text = EventsNotifications.Ds_BorrowerGenInfo.Borrower_General_Info.Columns(TBindex).ColumnName.ToString & ":"
    NewLbl.Font = New Font(NewLbl.Font, _
        NewLbl.Font.Style Or FontStyle.Bold)
    AddHandler NewTB.Enter, AddressOf WhichTextBox
    NewTB.ContextMenuStrip = ContextMenuStrip1
Next TBindex

"That rug really tied the room together."

modified on Tuesday, December 18, 2007 12:16:42 PM

GeneralRe: Looping through database columns Pin
nishkarsh_k18-Dec-07 18:31
nishkarsh_k18-Dec-07 18:31 
GeneralRe: Looping through database columns Pin
craigmg7819-Dec-07 5:27
craigmg7819-Dec-07 5:27 
GeneralWindows Service - timer tick event not firing. Pin
Steven J Jowett18-Dec-07 5:08
Steven J Jowett18-Dec-07 5:08 
GeneralRe: Windows Service - timer tick event not firing. Pin
m@u18-Dec-07 5:57
m@u18-Dec-07 5:57 
GeneralRe: Windows Service - timer tick event not firing. Pin
DigiOz Multimedia18-Dec-07 15:39
DigiOz Multimedia18-Dec-07 15:39 
QuestionMy break point not working properly Pin
poonams18-Dec-07 1:58
poonams18-Dec-07 1:58 
GeneralRe: My break point not working properly Pin
John_Adams18-Dec-07 11:25
John_Adams18-Dec-07 11:25 
GeneralRe: My break point not working properly Pin
Nilesh Hapse18-Dec-07 19:14
Nilesh Hapse18-Dec-07 19:14 
GeneralRe: My break point not working properly Pin
poonams19-Dec-07 1:37
poonams19-Dec-07 1:37 
GeneralImage Class in vb.net 2005 Pin
VB 8.018-Dec-07 1:24
VB 8.018-Dec-07 1:24 
GeneralRe: Image Class in vb.net 2005 Pin
C1AllenS18-Dec-07 3:57
C1AllenS18-Dec-07 3:57 
GeneralRe: Image Class in vb.net 2005 Pin
VB 8.018-Dec-07 18:10
VB 8.018-Dec-07 18:10 
Generalbutton.preformclick Pin
break_day18-Dec-07 0:50
break_day18-Dec-07 0:50 
GeneralRe: button.preformclick Pin
CPallini18-Dec-07 1:07
mveCPallini18-Dec-07 1:07 
GeneralRe: button.preformclick Pin
Luc Pattyn18-Dec-07 3:50
sitebuilderLuc Pattyn18-Dec-07 3:50 
GeneralRe: button.preformclick Pin
Johan Hakkesteegt19-Dec-07 8:29
Johan Hakkesteegt19-Dec-07 8:29 
GeneralProblems with Forms in vb.net Pin
Vimalsoft(Pty) Ltd17-Dec-07 21:48
professionalVimalsoft(Pty) Ltd17-Dec-07 21:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.