Click here to Skip to main content
15,915,813 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Start up Pin
nlarson118-May-07 7:58
nlarson118-May-07 7:58 
QuestionDataGridView - Display Row Numbers on Control Pin
RichardBerry8-May-07 4:26
RichardBerry8-May-07 4:26 
AnswerRe: DataGridView - Display Row Numbers on Control Pin
Rupesh Kumar Swami8-May-07 5:27
Rupesh Kumar Swami8-May-07 5:27 
GeneralRe: DataGridView - Display Row Numbers on Control Pin
RichardBerry8-May-07 7:43
RichardBerry8-May-07 7:43 
QuestionOffice 2007 ActiveX Pin
Stijn Courtheyn8-May-07 4:26
Stijn Courtheyn8-May-07 4:26 
QuestionNeed help with Word template Pin
Jats_4ru8-May-07 2:33
Jats_4ru8-May-07 2:33 
QuestionExtracting data from Web pages Pin
Farazj8-May-07 1:29
Farazj8-May-07 1:29 
Questionhow to access dynamically created control Pin
WorkingAcc8-May-07 1:07
WorkingAcc8-May-07 1:07 
hi all,

I dynamically create buttons on main_form, then in a module (functions) i try to access this controls by setting an focus to one of them.
when i try to access with "index = Frm_Main.CtrlFocus" it doesnt work becouse number of controls is zero since this frm_main is new instance i guess?!

Does anyone know how to fix this, and if there is a better way?

Thanks
greg


Public Class Frm_Main

Dim WithEvents BtnOperate As New OpenNETCF.Windows.Forms.Button2

Private Sub Frm_Main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.BtnOperate.Location = New System.Drawing.Point(20, 20)
Me.BtnOperate.Size = New System.Drawing.Size(150, 150)
Me.BtnOperate.TabIndex = 0
Me.Controls.Add(Me.BtnOperate)
Me.BtnOperate.BackgroundImage = b

Me.BtnTest2.Location = New System.Drawing.Point(340, 20)
Me.BtnTest2.Size = New System.Drawing.Size(150, 150)
Me.BtnTest2.TabIndex = 2
Me.Controls.Add(Me.BtnTest2)
Me.BtnTest2.BackgroundImage = b
End Sub

Public Property CtrlFocus() As Integer
Get
Dim i As Integer = Me.Controls.Count
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Focused Then
Return ctrl.TabIndex
End If
Next
End Get
Set(ByVal value As Integer)
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.TabIndex = value Then
ctrl.Focus()
End If
Next
End Set
End Property

End Class


Public Class Functions

Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SP1.DataReceived

BytesToRead = SP1.BytesToRead
Dim buffer(BytesToRead - 1) As Byte
SP1.Read(buffer, 0, BytesToRead)

message = message + System.Text.Encoding.Default.GetString(buffer, 0, BytesToRead)

SP1.DiscardInBuffer()

If message.IndexOf(Chr(3)) > -1 Then
Dim STX As Integer = message.IndexOf(Chr(2))
If message(STX + 1) = "K" Then
Dim index As Integer
Select Case message(STX + 2)
Case "U"
index = Frm_Main.CtrlFocus
index = (index + 4) Mod 8
Frm_Main.CtrlFocus = index
End Select
End If
End Sub


GeneralRe: how to access dynamically created control [modified] Pin
Colin Angus Mackay8-May-07 2:26
Colin Angus Mackay8-May-07 2:26 
QuestionApplication Shortcut Pin
harsh_c7-May-07 21:56
professionalharsh_c7-May-07 21:56 
QuestionRe: Application Shortcut Pin
Jelle Stokroos7-May-07 22:33
Jelle Stokroos7-May-07 22:33 
AnswerRe: Application Shortcut Pin
harsh_c8-May-07 0:02
professionalharsh_c8-May-07 0:02 
AnswerRe: Application Shortcut Pin
theScorp7-May-07 22:44
theScorp7-May-07 22:44 
AnswerRe: Application Shortcut Pin
Craster8-May-07 4:52
Craster8-May-07 4:52 
QuestionNested Datagridview question. Pin
cheeken2u7-May-07 21:12
cheeken2u7-May-07 21:12 
QuestionDatastage Connectivity through VB.Net [modified] Pin
jaysheel7-May-07 20:51
jaysheel7-May-07 20:51 
AnswerRe: Datastge Connectivity through VB.Net Pin
Christian Graus7-May-07 21:35
protectorChristian Graus7-May-07 21:35 
Questionhow to connect the vb.net windows application with ms access? Pin
sathyan_82947-May-07 20:46
sathyan_82947-May-07 20:46 
AnswerRe: how to connect the vb.net windows application with ms access? Pin
Tamimi - Code7-May-07 20:56
Tamimi - Code7-May-07 20:56 
AnswerRe: how to connect the vb.net windows application with ms access? Pin
Christian Graus7-May-07 21:35
protectorChristian Graus7-May-07 21:35 
QuestionBest practice to make the program multilingual Pin
re infecta7-May-07 19:39
re infecta7-May-07 19:39 
AnswerRe: Best practice to make the program multilingual Pin
Christian Graus7-May-07 19:55
protectorChristian Graus7-May-07 19:55 
GeneralRe: Best practice to make the program multilingual Pin
re infecta8-May-07 0:21
re infecta8-May-07 0:21 
AnswerRe: Best practice to make the program multilingual Pin
MatrixCoder7-May-07 19:57
MatrixCoder7-May-07 19:57 
GeneralRe: Best practice to make the program multilingual Pin
re infecta7-May-07 19:59
re infecta7-May-07 19:59 

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.