borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Speech Recognition)Next Topic (Help book for VisualBasic v6.0) New Topic New Poll Post Reply
AndreaVB Forum : VB General : Dynamic Controls
Poster Message
sangeeth
Level: Guest


icon Dynamic Controls

i need to know how to create command
buttons at runtime?

Also please give me the links for getting
free command(graphical) buttons.



[Edited by admin on 11-01-2003 at 09:22 PM GMT]

10-01-2003 at 08:07 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: very very urgent! help!

There was a similar topic at:

http://www.andreavb.com/forum/viewtopic.php?TopicID=40#129

it may provide the info you need (especially the Microsoft link in it).

Your request for free graphical buttons... Not sure what you mean really, a graphical command button is just a normal command button with the type (or is it style?) property changed to graphical, then you put a picture on it.


[Edited by JLRodgers on 10-01-2003 at 02:23 PM GMT]

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

10-01-2003 at 08:21 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Change Your Subject Title...

hello! welcome to the forum!

kindly change your subject's title next time, so that this post can be easily searched for by others who use the search option before posting at the board, okay? thank you.

as for the code, try this snippet i found a while back...

it includes a built-in control, and activex control, and a lib type

' If you are adding an ActiveX control at run-time that is
' not referenced in your project, you need to declare it
' as VBControlExtender.
Dim WithEvents ctlDynamic As VBControlExtender
Dim WithEvents ctlText As VB.TextBox
Dim WithEvents ctlCommand As VB.CommandButton


Private Sub ctlCommand_Click()
  ctlText.Text = "You Clicked the Command button"
End Sub

Private Sub ctlDynamic_ObjectEvent(Info As EventInfo)
' test for the click event of the TreeView
  If Info.Name = "Click" Then
    ctlText.Text = "You clicked " _
     & ctlDynamic.object.selecteditem.Text
  End If
End Sub

Private Sub Form_Load()
  Dim i As Integer
  ' Add the license for the treeview to the license collection.
  ' If the license is already in the collection you will get
  ' the run-time error number 732.
  Licenses.Add "MSComctlLib.TreeCtrl"
  ' Dynamically add a TreeView control to the form.
  ' If you want the control to be added to a different
  ' container such as a Frame or PictureBox, you use the third
  ' parameter of the Controls.Add to specify the container.
  Set ctlDynamic = Controls.Add("MSComctlLib.TreeCtrl", _
    "myctl", Form1)
  ' set the location and size of the control.
  ctlDynamic.Move 1, 1, 2500, 3500
  ' Add some nodes to the control.
  For i = 1 To 10
    ctlDynamic.object.Nodes.Add Key:="Test" & Str(i), Text:="Test" _
      & Str(i)
    ctlDynamic.object.Nodes.Add Relative:="Test" & Str(i), _
      Relationship:=4, Text:="TestChild" & Str(i)
  Next i
  ' Make the control visible.
  ctlDynamic.Visible = True
  ' add a textbox
  Set ctlText = Controls.Add("VB.TextBox", "ctlText1", Form1)
  ' Set the location and size of the textbox
  ctlText.Move (ctlDynamic.Left + ctlDynamic.Width + 50), _
    1, 2500, 100
  ' Change the backcolor.
  ctlText.BackColor = vbYellow
  ' Make it visible
  ctlText.Visible = True
  ' Add a CommandButton.
  Set ctlCommand = Controls.Add("VB.CommandButton", _
    "ctlCommand1", Form1)
  ' Set the location and size of the CommandButton.
  ctlCommand.Move (ctlDynamic.Left + ctlDynamic.Width + 50), _
    ctlText.Height + 50, 1500, 500
  ' Set the caption
  ctlCommand.Caption = "Click Me"
  ' Make it visible
  ctlCommand.Visible = True
End Sub


____________________________
Been busy trying to take a second degree <--it's not working out...

11-01-2003 at 06:47 PM
View Profile Send Email to User Show All Posts | Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: very very urgent! help!

Ah, the code from the Microsoft page.

It took me a half hour of searching the board to find the thread and the link that was originally posted.

Oh, and if/when you do change the subject, I'd suggest "Dynamic controls" or "Add controls at Run Time".




____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

11-01-2003 at 07:27 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VB General : Dynamic Controls
Previous Topic (Speech Recognition)Next Topic (Help book for VisualBasic v6.0) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder