|
I think this is a zen thing...
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Why don't you remove the data model from the UI? What I mean by that is create an object structure that is loosely coupled to the UI. Have a look at the Model-View-Controller pattern, I think it solves issues like this also. Possibly this isn't the answer that you're looking for, but it's probably the correct way to handle problems like this.
Scott P.
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
Sorry to go off topic here, but I googled the MVC pattern trying to find something extensive yet a little simple to get a basic grasp on it. If you have any recommendations, that would be amazing. Would be a nice article for CP as well (hint hint)
|
|
|
|
|
Here's a simple example, and although it's in Java it's understandable enough to grasp the concept.
MVC Temperature Example
Scott P.
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
http://www.dnrtv.com
I really liked JP Boodhoo's 5 part video on design patterns. He covers the MVC pattern really well.
|
|
|
|
|
Thanks guys, Im cracking on those videos right now
|
|
|
|
|
|
Well, I'd probably do it like this:
Use a tab control (by default, the main form has access to all of the controls/data on all of the included tab pages, so you can keep your data tightly coupled to the UI if that's what you really want).
or
Create each form on a UserControl object, and show/hide them based on what you need.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: so you can keep your data tightly coupled to the UI if that's what you really want
LMAO Brilliant. Even better, just put all your code inside the main() function!
led mike
|
|
|
|
|
I agree with him however remove the complexity by using the MVC pattern.
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
When you open form B and C I guess you pass data to them - if the form C data is constant then you could pass that to B at the same time...
Otherwise one way you could make this work is simply call public methods between the forms (A would be the parent of B and C)
lets say TextBox1 is on form C and you want the Text value in form B...
in form A:
FormB formB = null;
FormC formC = null;
formB = new FormB(); formB.Show(this);
formC = new FormC(); formC.Show(this);
Public string GetformCTextBox1Value()
{
return formC.GetTextBox1Value;
}
form B:
FormA parent = (FormA)this.Owner;
string formCTextBox1Value = parent.GetformCTextBox1Value();
form C:
public string GetTextBox1Value
{
get { return TextBox1.Text; }
set { TextBox1.Text = value; }
}
Chas
modified on Thursday, December 11, 2008 11:42 AM
|
|
|
|
|
hi everybody
how to handle leave(back to front & vice versa) event for a textbox in windows form using c#
|
|
|
|
|
Simple.
private void textBox1_Leave(object sender, EventArgs e)
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Hopefully this may help, its not exactly what you are trying to do but its similar
Excel.Application eApp = new Excel.Application();
Excel.Workbook wBook;
Excel.Worksheet wSheet = null;
Excel.Range rng;
object opt = Type.Missing;
wSheet = (Excel.Worksheet)wBook.Worksheets[0];
rng = wSheet.get_Range("1:1", opt);
rng.Font.Bold = true;
wSheet.UsedRange.Columns.AutoFit();
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thank you for your reply.
This works great with a static range, however, I still have the same problem.
I have the .get_Range() in a loop because it is going through a bunch of cells within the workbook.
For this, it I cant use a range like "l:l", it needs to be dynamic.
In VBA i would do something like Range(cells(i,1),cells(i,2)).Borders.blahblah .
I was attempting something similar in C# with objWkSht.Cells[i,c] (i and c being integer values) but it does not seem to be the way forward...
I would be very greatfull if you have any other idea's?
oooo, the Jedi's will feel this one....
|
|
|
|
|
i am doing a project on university transport system in C# by taking data about the students and getting the information about the specific student when the user will enter information about him (that of course will be id of the student)kindly help in it.
|
|
|
|
|
I'm eager to help when help is honestly needed, but...
This sounds like homework to me.
Beyond that, your requirements are too sketchy to provide any help at all. Maybe they should teach more preparatory courses so you learn how to gather, define, and present requirements before you're allowed to write any code. Who knows? You might find that your real calling in life is being a specifications writer, and you can haunt some other forum instead of trying to get us to help you with homework that a) you're too lazy to do on your own, and b) will most certainly suck in its final form.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: Beyond that, your requirements are too sketchy to provide any help at all. Maybe they should teach more preparatory courses so you learn how to gather, define, and present requirements before you're allowed to write any code.
Too true. I never thought about it before, but you're right, nearly all the homework questions have rubbish specifications/requirements.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
This should get you started.
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
namespace NeedsCode
{
class Program
{
static void Main(string[] args)
{
throw new NotImplementedException("The program code needs to be implemented.");
}
}
}
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
Lol
That one made me laugh.
|
|
|
|
|
That snippet of code does has an esteemed lineage. The only thing keeping it from the hall of fame is a unique modification by Mr. Simmons.
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
Great bit of code. Is it Ok to use it (under licence obviously) in a commercial application?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
No problem. I should probably update it with a license of some sort. Let me see what I can dig up.
I keep it on my CP blog if you'd like to add to it.
Scott P.
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
*awesome*
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|