|
If you don't want to do it via a select list, then you probably need to store the class names and use reflection to create them.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
can u pls explain the way how it can be done using reflection?
i will have only the name of the forms available and the selected form's name.
it will be string variables.
i need to refer the corresponding forms using this string variables..
regards,
robbins
Robbins
|
|
|
|
|
Let me ask you something first:
How do you get the values that will be displayed in the list?
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
the list will be from the Config file.
Robbins
|
|
|
|
|
Then I suggest that you use a custom config section and define a text that will be displayed in the list and a type that you can use to instantiate an instance of the according form.
Something like:
<FormSelection>
<Form text="My first Form" type="MyNameSpace.MyFirstForm, MyAssembly" />
<Form text="My second Form" type="MyNameSpace.MySecondForm, MyAssembly" />
</FormSelection>
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
similar is my config file. and the list is populated properly.
but then, in the button click event, i tried to create an object of the selected form. there it gives an error saying
"Value of type 'String' cannot be converted to 'System.Windows.Forms.Form'."
Robbins
|
|
|
|
|
has to be something like:
string typeString = ... string from config;
Type type = Type.GetType(typeString);
Form form = (Form)Activator.CreateInstance(type);
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Thanks a lot dude.
it works.
regards,
robbins.
Robbins
|
|
|
|
|
I'm happy I could help.
I'd be glad if you would rate my posts
Happy programming
Urs
-^-^-^-^-^-
no risk no funk
|
|
|
|
|
I rated your replies.
because it helped me building this configurable User Interface.
i got the exact answer i wanted.
once again, thanks to you.
regards,
robbins.
Robbins
|
|
|
|
|
Hi,
my question is how can i prevent that the user move my window of the workarea ?
and how can i tell my window that it shall be stick to the edge of the workarea when its close to it
|
|
|
|
|
How can I get to see the values coming into LPT1 378H? Is there a general method belonging to a class to call?
Thanks
Samuel
|
|
|
|
|
of cource, you need to use the dll file inpout32.dll.
[importDll....]
if this is not enough for you, i can send you a code which makes the work.
|
|
|
|
|
I have the dll file...but I can't figure out how to listen to the port..I have void PortAccess(Address)... why is it void??? how to I read than? the output is ok....but I cannt read the port
Samuel
|
|
|
|
|
hmmm, I have the following in the class is it correct
public class PortAccess
{
[DllImport("inpout32.dll", EntryPoint="Out32")]
public static extern void Output(int adress, int value);
[DllImport("inpout32.dll", EntryPoint="Inp32")]
public static extern voidInput(int adress);
}
shouldnt the last line be
public static extern int Input(int adress);
|
|
|
|
|
public class PortAccess
{
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Output(int adress, int value);
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
public static extern byte Input(int adress);
} // PortAccess
|
|
|
|
|
|
Hello Friends,
I want to know what is difference between protected and protected internal.
i know that protected means access limited to type and types derived from it.
and protected internal means access limited to type and types derived from it
or in the assembly.
Do protected is subset of protected internal. And do protected is required when
we specify internal as access specifier.
please give example that will be helpfull..
Thanks in advance.
rahul kulkarni
|
|
|
|
|
Rahul.RK wrote: I want to know what is difference between protected and protected internal.
According to the documentation[^] the answer is:
protected = Access is limited to the containing class or types derived from the containing class
protected internal = Access is limited to the current assembly or types derived from the containing class
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
hello Thanks for reply...
i got the concept according to definition.
But as internal gives access to all the assembly then
what is use of protected?
Thats my question..
Rahul Kulkarni
|
|
|
|
|
Rahul.RK wrote: But as internal gives access to all the assembly then what is use of protected?
So you can derive a class from it from outside the assembly.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thanks alot....
Will you please give me any helpfull site of book name
which will give me idea of all this basic fundamentals of C#.Net
Rahul Kulkarni
|
|
|
|
|
There are lots of beginner books. It really depends on your style of learning. Go to the book store and browse through a few books. Pick the one that appeals to you most.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thanks for help.
Rahul Kulkarni
|
|
|
|
|
Hello i am facing a slight problem with Store a record in the database.
I have a column of Type Decimal (It can have null values in the DB).
i take the input in a textbox and saves it to the database.
dataRow["SPEED"] = (this.tbSpeed.Text == "" ? DBNull.Value.ToString() : this.tbSpeed.Text);
If I leave it blank it gives me following error
An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll
Additional information: Input string was not in a correct format.Couldn't store <> in SPEED Column. Expected type is Decimal
What could be the solution to this problem
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|