|
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.
|
|
|
|
|
According to your info ....
Store the information of student in the database and retrieve when user enters the id ,
Simple
|
|
|
|
|
I want to put some data in listBox, then if I want to remove one data, I remove it from the listBox and then overwrite data in listBox to a text file. But it was always failed when it debugged WriteToFile() method below. I dont know why it was failed. It told that "An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll"
public void menuItemUn_Click(object sender, EventArgs e)
{
listBoxBlockedNumberDD.Items.Remove(listBoxBlockedNumberDD.SelectedItem);
DeleteFile(Filename);
WriteToFile();
}
public bool DeleteFile(string Filename)
{
try
{
if (File.Exists(Filename))
{
File.Delete(Filename);
return true;
}
else
return true;
}
catch
{
return false;
}
}
public void WriteToFile()
{
while (listBoxBlockedNumberDD.Items != null)
{
using (StreamWriter swb = File.CreateText(Filename))
{
<big>swb.WriteLine(listBoxBlockedNumberDD.Items);</big>
swb.Close();
}
}
}
It was always failed in the Big line(WriteLine). I've tried all kinds of Write to file method but there was nothing worked. Could you tell me where is my mistake?
irsalina [student]
|
|
|
|
|
You have to check a couple of things ....
1) create streamwriter object outside the while loop.
2)and close it after loop is completed.
3)Debug and see I think it would be like "swb.WriteLine(listBoxBlockedNumberDD.Items[index].text); (you may have to use for loop from 0 to item.count)
|
|
|
|
|
Well, I've tried and I guess you meant it this way.
public void WriteToFile()
{
using (StreamWriter swb = new StreamWriter(Filename))
{
for (int i = 1; i <= (listBoxBlockedNumberDD.Items.Count+1); i++ )
{
<big>swb.WriteLine(listBoxBlockedNumberDD.Items[i].ToString());</big> }
swb.Close();
}
}
But now, the Big line threw error :
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: ArgumentOutOfRangeException
Parameter name: index
How could this happen?
irsalina [student]
|
|
|
|