convert string into object

Reply

Join Date: May 2007
Posts: 20
Reputation: pranto157 is an unknown quantity at this point 
Solved Threads: 0
pranto157 pranto157 is offline Offline
Newbie Poster

convert string into object

 
0
  #1
Sep 5th, 2007
dim a as checkbox
dim b as string

b= "check1"

a=b

this code give me error.

is ther any fuction to convert string into an object ? like cstr().
or what is the procedure to convert a string into an object ?
plz help me.

i need help
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: convert string into object

 
0
  #2
Sep 5th, 2007
Hi,
I think u r trying to create a checkbox on runtime and give it the name stored in variable b. if so below is the code to do it:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command1_Click()
  2.  
  3. Dim a As CheckBox
  4. Dim b As String
  5.  
  6. b = "check1"
  7.  
  8. Set a = Controls.Add("VB.CheckBox", b)
  9.  
  10. With a
  11. .Visible = True
  12. .Caption = b
  13. .Top = 50
  14. .Left = 50
  15. End With
  16.  
  17. End Sub
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC