Question Convert string to syntax ?!?

SenaMas

Member
Joined
Nov 21, 2009
Messages
5
Programming Experience
1-3
Hi every body

I wonder if there is a Type that converts a string to a VB syntax to be read by the compiler.

for example:


Dim command1, command2, command3 As what??!
Dim drv as DataSet.Datarow
drv = CType(BindingSource.Current, DataRowView).Row
drv.K01= something
drv.K02=somthing else
.
.
.

getkey is a string with values like "01","02",... and is got by the sub args.
command1 = CType("drv.K" + getkey, what??!)
command2 = CType("drv.K" + getkey + "1", what??!)
command3 = CType("drv.K" + getkey + "2", what??!)
tbox1.Text = command1 '>>> command1 acts just like a sub or Function
tbox2.Text = command2
tbox3.Text = command3
'==========================================

thank you for your attention.
 
this is my exact question.
I refer to where?define it what?
I think it's better I generate my code in this way with another application then Copy and Paste it to my App.
-------------------------
Do you have another way?
 
The fields in your dataset will be predefined by virtue of being bound to fields in your backend database.

Variables will also be predefined, but through programming code.

That is what we are trying to arrive at. Lets just take one of them.

When you use Command1, what will you use it for?
 
I think what he wants to do is actually store code in his commands like
Dim command1 As 'code'
command1 = if blah = blah then blah blah blah end if

Not necessarily an if statement, but he wants to store functioning code as a variable, is that correct?

I dont know how to do it, but have wondered if it was possible before. That would really be handy
 
Ahhh...well if that is what he wants, then No, you can't do that. You can't store functioning code in a variable that the compiler will recognize as code that should be executed.
 
I don't want to store it. I just want to create it through Compiling Process.for example storing it in a string or generate it before being compiled.and compiler use the string after being generated for its process.That's not unseemly or unreachable I think.
 
Back
Top