|
I'd like to help you with this, but what you observe is different than what I observe in Visual Studio 2012 (and what I observe is also different from what OriginalGriff observes).
I don't understand this:
B) Form that contains an instance of Usercontrol A
Class FormWhatever : UserControl If you create a Form, and then set it to inherit from a UserControl, it is no longer a Form, but a UserControl ! Yes, you can put an instance of the same UserControl that a Class inherits from "in/on" the same UserControl, but, why would you ? You've created the equivalent of a person holding a tv-screen showing a picture of themselves
And, this:
2) The form that is loaded at program start is the usercontrol. You cannot start a WinForms .NET program with a UserControl: you'll get a compile-time error like this: "Error 2 Argument 1: cannot convert from '...UserControl.Form#' to 'System.Windows.Forms.Form"
And, this:
The base control isn't loaded unless the user chooses to go into that form. what do you mean by "go into that Form" ?
If your goal here is to provide all the secondary Forms in your Application with a common search facility, and you wish to use a "Main Form" as a kind of "master-controller" from which you show the secondary Forms:
1. create a new WinForms app: design your Main Form
2. create a new UserControl: design it. implement Public Properties, Methods, etc., ... or Events ... so that consumers of the UserControl can use/access information inside the UserControl
3. create a secondary Form template which will serve as a base for all secondary Forms: put an instance of the UserControl on it. Do not "show" this template Form. this Form should not inherit from anything.
4. at design-time, you can define new instances of the secondary Form template by setting them to inherit from the secondary Form template rather than "Form."
5. or, at run-time, you can create new instances of the secondary Form Template as needed in response to the end-user's actions, and display them on screen where you want them.
What you may need to do to "keep track" of any secondary Forms which have been created at run-time may vary depending on what your Application does.
Keep it simple, keep it clean, and prepare to be confused
bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
Exemple stetment
foreach (DataGridViewRow row in gridControl1.Rows)can't Rows
{
mailbody += "<tr>";
foreach (DataGridViewCell cell in row.Cells)
{
mailbody += "<td>" + cell.Value + "</td>";
|
|
|
|
|
And your question is?
Veni, vidi, abiit domum
|
|
|
|
|
Member 10270825 wrote: can't Rows
I'm not surprised.
The DevExpress GridControl doesn't have a Rows property: DevExpress GridControl Members[^] - and even if it did, it is very, very unlikely to return DataGridViewRow values - they are associated with the .NET DataGridView control...
The only instant messaging I do involves my middle finger.
English doesn't borrow from other languages.
English follows other languages down dark alleys, knocks them over and goes through their pockets for loose grammar.
|
|
|
|
|
|
I want to use Roulette wheel selection for function minimization and want to select parents for reproduction from the fitness values. I want to ask is this necessary to sort the fitness (in ascending or descending order) values calculated from the population size or not?
|
|
|
|
|
You can use random number generation to simulate roulette wheel output.
Try something and post your code here.
|
|
|
|
|
You may want to read up on "Roulette Wheel Selection[^]" before you stick your foot in your mouth again.
modified 24-Oct-13 12:33pm.
|
|
|
|
|
Weird - but the link is not working?
|
|
|
|
|
*Cough* ahem[^]. I assume you ate the rest of the foot
|
|
|
|
|
Hmmm... It pasted back into a browser window just fine before I pasted it into the post.
Fixed!
|
|
|
|
|
In the book I'm studying and the articles at MSDN, they both say pretty much the same thing…
Just to clarify, in my book it uses this example:
Parent Class
{
}
Child Class
{
}
Grandchild Class
{
}
GreatGrandchild Class
{
}
The Base Class for Great-Grandchild Class would be the Grandchild Class
The Base Class for The Grandchild Class Would Be the Child Class
The Base Class for the Child Class Would Be the Parent Class
If that is true, in both my book and the articles at MSDN also say if I want to call a method that resides in the parent class from great-grandchild class to use the "base" keyword before the method…
Just a little confusing, maybe I read it wrong and misunderstood it.
Any feedback would be greatly appreciated.
|
|
|
|
|
You are right in your assumptions.
Just to correct your code a little bit though -
Parent Class
{
}
Child Class : Parent
{
}
Grandchild Class : Child
{
}
GreatGrandchild Class : Grandchild
{
}
|
|
|
|
|
First of all, you need a method or property which is declared "virtual". That allows you to "override" it in derived classes.
When you override such a virtual function, but need to call the functionality of the original implementation also, you use the base keyword:
public class Parent
{
public virtual void FunctionOne()
{
}
}
...
public class GreatGrandChild : GrandChild
{
public override void FunctionOne()
{
Console.WriteLine("Called in GreatGrandChild");
base.FunctionOne();
}
}
Otherwise, you can access the functions of the base which are not overriden just like any other function of a class, and beyond that you can access "protected" functions/properties.
|
|
|
|
|
Yes, That's Obvious… Or so I thought it was.
|
|
|
|
|
I wanted to create a application in which there will be 10 to 12 users(clients) and database at one place(server).
My Qs is how to create this kind of application and what technology should I use between these..Windows ? or Web based ?.
Pls tell me how to implement this kind of app.
Pls give links to sample application if anyone knows..
thanks in advance.
|
|
|
|
|
What you are really looking at here is usually known as a client-server application. The database will be placed on the server and the client will reside, well on the client. There are many different ways you can partition your application; for instance, you could partition it so that using MVC and an n-tier architecture.
As to what type of app you should write - that really depends. If you need to interact with the local file system, I'd go with a desktop based approach. If everything could be handled through a browser, then I would go with a web based architecture. Only you know your requirements.
|
|
|
|
|
Thanks for ur quick reply.
Everything can be handled through browser. so I think I will go with web based application.
Can you provide some links on these kind of applications or a small sample ?
|
|
|
|
|
Here is a MVC4[^] implementation but I wouldn't use EF.
Edit I forgot to add the link.
Edit 2 Link paste bug.
David
|
|
|
|
|
See this[^] step-by-step tutorial.
/ravi
|
|
|
|
|
Pdeveloper wrote: Windows ? or Web based ?.
What is your client looking for?
Are they ok if you install the client on their local machines.
|
|
|
|
|
I have "bought into" the view that programmers in WinForms should not put a Form inside a Form. My reasoning has gone something like this: [1]
1. A Form is a "heavy-weight" object; using "lighter-weight" objects. like a Panel on the Form, a UserControl (for re-usability), or other ContainerControl(s) on the Form, is better practice. And, I believe the idea of using a TabControl to implement a multi-document work-space is a good one.
2. A Form within a Form (if it is movable: that is, if it has a TitleBar) can easily be moved at run-time so almost all of it is "outside" its Parent Form. It's actually possible to "lose track," visually, of a Form within a Form if: you do "just the wrong thing" while the outer Form is Maximized, and then set the Form WindowState back to 'Normal. Of course, the programmer, can easily write code to control for such cases.
3. Particularly for newcomers to programming in WinForms, putting a Form in a Form is "bad practice" that leads to programming errors, hair growing on the palms, etc.
If I consider what, if any, advantages there might be to using a Form within a Form, I find it hard to come up with anything tangible. Using multiple independent windows (Forms) in an app: yes, I can see that (and I write apps that way); each Form can have its own Opacity value, for example. And, the programmer, with a small amount of effort, can implement docking of the independent Forms to their "main Form," or other Forms, etc.
Based on the belief that questioning one's technical assumptions (frequently) is a healthy thing to do, I'm curious to ask you, my peers, and betters, what you think about putting Forms inside Forms:
1. is it something you do yourself in your own practice (in situations you are not using MDI) ?
2. is it a very "bad thing" in terms of consuming resources (like memory) compared other possible containers ? Does it diminish performance ?
3. do you think it is a mistake for beginning programmers to use Forms inside Forms ?
all-ears, bill
[1] I've left MDI out of this discussion, even though CP is still getting questions on MDI: questions from people working with/on legacy apps; and, questions that I believe are coming from students who are assigned to create an MDI app in their classes. I go along with the view that MDI is outmoded, and read that MS has "deprecated" it. Bias: I find MDI apps butt-ugly.
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
I must say I have never placed a form inside another form and can see no reason to do so - none of the situations I have ever found myself in have needed this.
So it would be interesting to hear about its benefits, if there are any(I think it would just mess my head up trying to debug that sort to of scenario).
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I'm just a newbie to C#, but… I'm just starting to read about and understand some of, Polymorphism… Whatever methods you have in your main class, you could change them to virtual methods then by using inheritance… The methods in your child classes could use override.
Like I said, I'm just a newbie… But, just a thought.
|
|
|
|
|
- No, sounds like a bad idea.
- I would say yes it's a bad thing, but I have never tested it to see the effect on resources/performance.
- Certainly, they do enough bad things as it is.
Veni, vidi, abiit domum
|
|
|
|