|
Is this a winform or an Web page
|
|
|
|
|
Sorry, its a winform. Would be useful if it would work when I ran it on linux with mono(just to be future proof).
|
|
|
|
|
You first need a method of loading an assembly from a path. You can use Assembly.LoadFrom for that. Then you can call GetTypes on the result from that; you'll get a collection of Types from that. Iterate through each of those, and check to see if it inherits from Control. If it does, call Activator.CreateInstance and cast it to a Control instance. Then you just have to add it to a form and do your sizing
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Sounds good, thanks alot
|
|
|
|
|
Cool got it working. Thanks alot!
By the way for anyone reading this heres the code I used excluding the obvious positioning and fluff:
<pre>
Assembly asm = Assembly.LoadFrom(dlldirectory);
Type typ = asm.GetType("My_Control.UserControl1");
UserControl uc = (UserControl)Activator.CreateInstance(typ);
this.Controls.Add(uc);
</pre>
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
Hi,
I have a method which is in another project (but in the same solution), I create a delegate to that method and then use delegate.BeginInvoke to Asynchronously call that method and the callback method is in the calling project. Now the problem is when the invoked method completes, I need to somehow signal the callback method if the invoked method has succedded True or False, and because the invoked method is in another project and the calling method is also in another project and this project has a reference to the invoked method project if I try to set some variable in the calling project from invoked method project I can't because i don't have a reference to this project and if I try to reference the project i get a circular dependency error.. which is resonable...
This is the code:
private delegate void edi2xml_delegate(object ar);
private edi2xml_delegate edi2xml_del;
public void convert_file(object async)
{
DemoApplication.edi_test edi2xml_converter = new DemoApplication.edi_test();
edi2xml_converter.file_path = pub.def.edi_file_directory + "\\" + file_list.file_name;
edi2xml_del = new edi2xml_delegate(edi2xml_converter.convert);
edi2xml_del.BeginInvoke(null, import_xml2db, (string)(pub.def.edi_file_directory + "\\" + file_list.file_name + ".xml"));
}
private void import_xml2db(IAsyncResult ar)
{
string full_path = (string)ar.AsyncState;
edi2xml_del.EndInvoke(ar);
}
public void edi2xml()
{
}
Any help or suggestions greatly appreciated.
|
|
|
|
|
Hi,
I suggest you have a look at BeginInvoke, EndInvoke and IAsyncResult. This trio normally manages to synchronize with and obtain return values from asynchronous operations.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi to all,
I have a problem regarding form resizing. I am devloping a window application using C#.NET. I am using an MDI Form to open other Forms. I have set padding property of that MDI Form.
The problem I have is, whenever I am Changing the screen resolution My form does not resize.
Please help me to solve my problem. How can I resize my window Form dynamically as per the screen resolution changes or is there any solution so that eventhough the screen resolution changes My form design should not change
--
Thanks & Regard
Sanket Patil.
.
|
|
|
|
|
Catch the Microsoft.Win32.SystemEvents.DisplaySettingsChanged and DisplaySettingsChanging events. When you receive the DisplaySettingsChanging event, make a note of the then-current resolution. When you receive the DisplaySettingsChanged event, get the current resolution. You now have the two needed resolutions; if they're equal, you don't need to do anything. If they aren't, then the Form's width is [PreviousWidth * (previousResolution.Width / currentResolution.Width)] and the height applies the same formula, but with heights instead of width
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
How do I get a form to lock focus to where the user cannot switch to the parent window without closing it first?
Y*Live Long And Prosper*Y
|
|
|
|
|
False Chicken wrote: How do I get a form to lock focus to where the user cannot switch to the parent window without closing it first?
It can be Simply Done by ShowDialog() method.
Form frmNew = new Form2();
frmNew .ShowDialog();
Hope this will help you
|
|
|
|
|
Worked like a charm! thanks
Y*Live Long And Prosper*Y
|
|
|
|
|
hi
i am doing a setup of a Project developed in c#
now while installing (at the begining of installation process) the setup
i want to know the person role who is installing
i mean , if the installing person is a user then it should not be installed/uninstalled
The installation/uninstallation rights should have for only admin but not users
is there any solution for this...
|
|
|
|
|
This can only be done by your System Administrator or Network Administrator. To deny users rights to install anything or uninstall anything.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
How are you creating the setup?
I know you can check if the user is an admin and cancel the installation using WiX[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
vijaylumar wrote: i am doing a setup of a Project developed in c#
The question here is - what do you mean by "doing a setup"? Are you using a setup program or writing code to build an installer? Which OS are you targeting? If you're using an installer, there's nothing more that you need to worry about, because an "installation" can be done only by an administrator.
If you're writing it yourself, it's a matter of mentioning it in your project's manifest file that it needs administrative privileges. (line of interest would be level="requireAdministrator" under requestedExecutionLevel , if I remember it right... can't pull it off now, not on a dev machine. Just google if doubtful).
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
hi
i m doing setup using .net ide i.e Setup and Deployment Project Type
|
|
|
|
|
hello, I have an usual problem ( a least for me ), where I created multiple objects (say b1, b2, b3 ,b4 ) from the same class (b) inside another class (class a), the object is a1.
The variable for class b such as "value" is changed for every object, for example
a1.b1.value = 10;
also a1.b2.value = 20;
..
..
..
now when the value of 20 is entered in b2 the value in b1 is also changed to 20.
Did anyone see this problem earlier?
thanks
|
|
|
|
|
Hi,
show actual code (in PRE tags!) and someone will explain to you what happened.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
At a guess, it sounds like when you create your objects you are ending up with them all pointing to the same reference but without code it's hard to explain what is happening.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
sounds like u did a code by using reference type.. so that it copied 20 to another object also..But we need to examine the code
sureshkumar.S
|
|
|
|
|
Hi everyone,
I'm very new to programming and have run into a snag that I can't seem to figure out.
I have some pretty simple classes for a grading program. I have four classes (Course, Student, Assignment, StudentAssignment) StudentAssignment inherits from Assignment and adds a grade and notes.
Course has a list<assignment>
Student has a list<course> and a list<studentassignment>
When I add a course to Student list<course> I use the constructor for StudentAssignment to add a studentAssignment for every assignment in list<course>
Now, I need to keep the two in sync. What is the best way to do this. I tried foreach loops but since I can't downcast Assignment to StudentAssignment it's tough to compare the two.
I know there's probably a million ways to do it. Can anyone help?
|
|
|
|
|
Without seeing at least the basics of what you have setup it's difficult. What do you mean "keep the two in sync"? Which "two" are you referring to?
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
my original post didn't work right.
It should say course has a List<<Assignment>>
Student has a List<Course> and a List<StudentAssignment>
Since the student takes a course, all the assignments from that course should be in their Student assignment list.
The two things I need to keep in sync are the Assignment list from the course and the assignment list for the student. When I add or delete an assignment from the course assignment list, it needs to be added or deleted in the student assignment list also. If I delete a course from the student course list, I need to delete all assignments related to that course from the student list also. That's what I mean by "keep the two in sync"
|
|
|
|
|
Again Sorry.
Course has a List<Assignment>
|
|
|
|