|
I dont understand, why are you searching for a readymade code...
All these forums and members here are just to help if you get stuck with something but not to completely do your work...
I dont think its too hard to convert a C# code in to VB.Net Code, if you know the basics and syntax of VB.Net...
Please give a try yourself... That will enhance your ideas and programming skill as well....
My hearty wishes for a successful project....
Have a Happy Coding.....
|
|
|
|
|
How to declare/tie a mdigrandchild form to mdiGrandParent form?
Situ:
I'm writing some code/mdiParent that spawns a child form, child1, that has all the information capturing. Now child1 spawns a child, grandchild. The grandchild is a lean version of child1, readonly type situation. Child1 is not shown, but working. Grandchild is to: Grandchild.show().
Needed:
I need to declare the grandchild to show in the mdiParent. I'm sure it's somthing similar to :
The parent is MainIndiv_Truck_ControlMDI : Form
the child1 is declared in the parent as:
Indiv_Truck_Control TruckForm = new Indiv_Truck_Control();
TruckForm.MdiParent = this.
I know I'm missing something. I can make the grandchildren, but there happening outside the MdiParent. I want them to happen inside MainIndiv_Truck_ControlMDI : Form
Thanks in advance.L.
|
|
|
|
|
I am not sure that I totally understand your question, but I think that you want the grandchild form to be bound within the parent form?
If that is so, just set the grandchild forms' mdiparent property to the parent form as well.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
I would but what is the method if I can't use:
The parent is MainIndiv_Truck_ControlMDI : Form
the child1 is declared inside the parent as:
child1 = Indiv_Truck_Control TruckForm = new Indiv_Truck_Control();
TruckForm.MdiParent = this;
Then child1 spawns a child of its own, grandchild.
The grandchild has to be inside the MainIndiv_Truck_ControlMDI : Form.
grandchild.Mdiparent = "what"?
I'm not sure how to say the "what"? part.
Thanks
|
|
|
|
|
For the grandchild form to be contained inside the grandparent form it must be
grandchild.Mdiparent = MainIndiv_Truck_ControlMDI
otherwise it won't be contained.
You can put a form inside another, but you won't get the benefits of the MDI interface.
Like this:
Form grandchild = new grandchildForm();
grandchild.TopLevel = false;
grandchild.Parent = MainIndiv_Truck_ControlMDI;
grandchild.Visible = true;
grandchild.Location = new Point(10, 10);
grandchild.Size = new Size(100, 150);
grandchild.BackColor = Color.Bisque;
MainIndiv_Truck_ControlMDI.Controls.Add(grandchild);
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ok, I've Googled myself silly. I need to create a List<> instance based on a System.Type instance, the list must not contain a bunch of Type instances like List<system.type> x;</system.type> but more like:
Type objectType = objectInstance.GetType();
List<objectType> objects = new List<objectType>();
objects.Add(objectInstance);
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
|
The binding of generic parameters occurs at (mostly) compile-time. Unfortunately, what you want can't be done at run-time. The closest you can get is with using Reflection.
Type objectType = objectInstance.GetType();
<span style="color:green">
Type unboundListType = <span style="color:blue">typeof</span>(List<> );
Type boundListType = unboundListType.MakeGenericType(<span style="color:blue">new</span> Type[] {objectType});
ConstructorInfo ctor = boundListType.GetConstructor(Type.EmptyTypes);
<span style="color:blue">object</span> genericBoundList = ctor.Invoke(<span style="color:blue">null</span>);
<span style="color:green">
MethodInfo info = boundListType.GetMethod("Add");
info.Invoke(genericBoundList, <span style="color:blue">new object</span>[] { <span style="color:blue">new</span> Moo() }); Hope that helps.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thanks for the help, did the trick. Took me a whle to understand what was going on... I'm already using reflection extensively so this fits in to the rest of my design
____________________________________________________________
Be brave little warrior, be VERY brave
|
|
|
|
|
I'm glad to read that!
Happy coding.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
How do you use an object to return constants... or to select them...
like:
Whatever.CCN.use.HomePermanent; (when you hit the '.' after 'use' you get other options)
or I would like to set it like this
Whatever.CCN.use = "HP";
So in the 'use' class there would be constants set
HomePermanent = "HP";
HomeVacation = "HV";
WorkPlace = "WP";
Home = "H";
|
|
|
|
|
|
Ok I've declared the enum
but now how do I use it in a class struct:
enum nameuse { Legal = "L", Alias = "P", None = "" };
public class theName
{
public string use; // so that this is supposed to only have 3 options
public string prefix;
public string FirstName;
public string Middle;
public string LastName;
public string Suffix;
}
|
|
|
|
|
instead of declaring use as a string declare it as nameuse
public nameuse use;
use = nameuse.Legal;
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
If I'm not mistaken it would be:
public nameuse use;
Then you should get a list when you use InstanceOftheName.use = (List of options)
Also I believe enums have to be a numbered list. Like this:
enum nameuse { None = 0, Legal = 1, Alias = 2 };
If you want something to return a string based on a letter, usually you have to use a function with a switch case statement inside it to return the value you want. That won't give you the nice ordered list in the IDE though.
Of course I've been relegated to the vb6 world of doom for a while now so my thinking could be a bit off on c#.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
Yes I just got an error mesg... trying this method on:
Cannot implicitly convert type 'string' to 'int'
public enum nameuse { Legal = "L", Alias = "P", None = "" };
and it points out on each of the stringed items... as if they need to be Integer.
I think I'll go back to Hanlon's method... and attempt that direction.
|
|
|
|
|
public static class use
{
public const string HomePermanent = "HP";
} This could be used by string myValue = use.HomePermanent; Is this what you're after?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys
|
|
|
|
|
ok I tried your method...
public static class thenameuse {
public const string Legal = "L";
public const string Alias = "P";
public const string None = "";
}
public class theName
{
public thenameuse nameuse;
public string prefix;
public string FirstName;
public string Middle;
public string LastName;
public string Suffix;
}
public theName[] Name;
but from the form class...
cn.Patient.Name[0].nameuse. (I do not get the the const values to populate when hitting the '.') I tried a few things, to no avail. What am I missing?
|
|
|
|
|
referenced them by
nameuse.Legal
nameuse.Alias
Thank you! I got it now!
|
|
|
|
|
Hi,
I have a project suite that is written in vb6. Since some of the programs in the suite don't work, I created the same programs in c#. How can I create a setup file that will have the rest of the vb6 projects and c# projects?
Also, if this message doesn't belong to this message board, I apologize and would like it if you can tell me where I can ask this question.
Thank you,
Prateek
|
|
|
|
|
Hi;
i am writing some codes. that codes are found and mark any squares,circles on image.I know that its very complicated. So please help me. I'm waiting for helps.
thanks for helps.
Ali GOKDEMIR
|
|
|
|
|
Graphics dc = this.CreateGraphics();
Pen redPen = new Pen(Color.Red, 10);
dc.DrawEllipse(redPen,10,10,50,50);
|
|
|
|
|
... not forgetting to call Dispose on the Graphics and Pen objects of course - better done in using blocks so you can't forget.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
thanks for mail. Your codes are usefull. But i want to found shape (ellipse, square...) on picture.
how can i write like this?
|
|
|
|
|
hi. i think you are looking for a template matching algorithm.
there are several ways for this. but the main problem in all algorithms is the size of object.
if you looking for a fixed size object then it can be a little easy but when you looking for circles of any size then you should read expert articles in this context.
sorry but i don't think that anyone in this heaven can give you a perfect code of this.
just google the "template matching" or "object recognition" to get some clues.
sometimes 0 can be 1
|
|
|
|