|
Sorry it took too long to reply....my father died last weekend.
Do this:
Your work with docking the control on the left is fine.
Make certain that your frmHome Dock = Fill.
frmHome fillscrn = new frmHome();
fillscrn.MDIParent = this;
fillscrn.Show();
Now what this gives you is your Outlook style on the left which slides in and out. A second window on the right that fills the area. It's code functions independant which is fine as long as your main form has no need for catching events from the child.
If you want a TRUE outlook experience, then you can take an easier approach:
mainForm is your only form.
Drop in a panel and create your OutlookPanel inside this panel (Dock=Left).
Drop a slider in the form.
Drop another panel in the form Dock=Fill
Populate the panel with all your data.
This gives you a true Outlook experience but it is a fairly static form. With the MDIChild approach you gain a benefit if you are showing a different form for different users -- since you can encapsulate your logic within each individual form.
Another benefit of the MDIChild approach is that the panel (your right-filled form) is coded as a stand-alone form which contains all of its' logic in one place and is not scattered among the icon bar logic and other form management tasks.
If the child form needs to be notified that an icon was clicked in the Outlook bar, then you expose those via events (full detail is in the MSDN help files within VS)
Hope this moves you forward.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
<input id="MyFile" type="file" runat="server">
This control produces a textbox w/browse button. I've tried in the server side to set
this.MyFile.Value = MyFile.PostedFile.FileName;
in order to repopulate the textbox part when returning a message such as "file successfully uploaded". It's not taking it.
Any ideas?
|
|
|
|
|
Your browswer shouldn't let you specify a file in HTML or javascript...doing so would be very insecure. Imagine someone setting the value of the textbox to the location of a well known file, such as the MS Money 2002 data file, then using JavaScript to submit the form
Even if you skipped the submittal via javascript you could use some CSS/HTML trickery to hide the file selection box, keeping your default value of the well known file.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Hi,
In my WinForm App, I have to show another form2. but I do have to know if the user click on OK or Cancel. therefore I assigned DialogResult property of OK and Cancel button on Form2 to OK and Cancel, respectively. It works fine and I can use Dialogresult to figure out whether the OK or Cancel button is clicked to close the Form2.
The problem comes in when I add a errorProvider1 to form2, I use it to make sure a couple of textBoxes are not empty and then SetError on ErrorProvider. Because the OK button has DialogResult.OK property set, the dialog closes before I got chance to view the error.
Is there anyway to prevent the dialog form close if I have any errors. It is so easy to do in old MFC days. .
Dion
|
|
|
|
|
Why not just catch the yourbutton.OnClick event?
private void button1_Click(object sender, System.EventArgs e)
{
if(textBox1.Text.Length == 0 || textBox2.Text.Length == 0)//etc.
{
//Your error handling code
MessageBox.Show("Please, enter some text");
return;
}
this.Close();
}
Hope being helpful
Cheers,
Gogou
GAtanasov
|
|
|
|
|
Thanks for your help.
I definitely can do my validation on btnOK_click event, but how do I know from my main form whether an user clicked on OK button or Cancel button if I do not set the DialogResult property. But if I set DialogResult property, the OK button closes the form before I can see the validation errors.
I'd like to achieve BOTH:
1. TextBox Validation when OK is clicked, if there is error, do not close the form.
2. If there is no error, the Form2 is closed. From the caller, I want to know whether an user click on OK or Cancel.
How do I achieve this?
Dion
|
|
|
|
|
DionChen wrote:
TextBox Validation when OK is clicked
Handle the Validating and Validated events on your textboxes. If you look up the Control.Validating event in MSDN you'll see an example using the events with the ErrorProvider class.
Just remember to set the CausesValidation property to false on at least the cancel button, or you can't click it without providing valid data.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
You can achieve this by setting the form2 DialogResult to None. EX:
if (txtName == "")
{
//Show error message
this.DialogResult = DialogResult.None
}
No time to breathe
|
|
|
|
|
In the parent form:
<br />
GetMyData diagInfo = new GetMyData();<br />
if (diagInfo.ShowDialog() == DialogResult.Cancel)<br />
{<br />
cancel logic<br />
}<br />
else<br />
{<br />
doit<br />
}<br />
The dialog form:
<br />
public GeMyData<br />
{<br />
}<br />
public string GiveMeInfoOne<br />
{<br />
get<br />
{ return info1.Text; }<br />
}<br />
public string GiveMeInfoTwo<br />
{<br />
get<br />
{ return info2.Text; }<br />
}<br />
private void button1_Click(Object sender, EventArgs e)<br />
{<br />
if (info1.Text == "" or info2.Text == "")<br />
{<br />
MessageBox.Show("You really must enter data in my text boxes or I<br />
will never go away and I will haunt you the rest of your days");<br />
}<br />
else<br />
{<br />
this.DialogResult = DialogResult.OK;<br />
this.Close();<br />
return;<br />
}<br />
}<br />
Voila -- your dialog never closes until you have a good bit of data in each box and you actually execute a return.
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Does anyone know how i can change the color of the background of a checkbox in a tree view? The treeview is in a non-standard color and the white of the checkbox doesnt look right at all.
i read about the tri-state checkbox image but i dont think i want to take it that far at this stage.
|
|
|
|
|
Hi,
i would like to let the user edit his data in a datagrid. The datagrid is bound to a dataset. If the user close the form i would like to know:
- are there changes?
- would he like to accept or reject changes?
<p>But this do not work, cause it seems that the datagrid flush the data on dispose to the dataset, could that be ? cause HasChanges() returns false, all the time, even if i've got changes made to the Datagrid/dataset.
Is there a way to flush the changes made in datagrid to dataset, then check it, ask user and accept or reject changes ?
.:Greets from Jerry Maguire:.</p>
|
|
|
|
|
Override on closing rather
This what I did (in fact just yesterday):
<font size=2 face="Courier New"><font color="#0000FF">protected </font><font color="#000000">override </font><font color="#0000FF">void </font><font color="#000000">OnClosing</font>(<font color="#000000">CancelEventArgs e</font>)
{
<font color="#000000">DataSet ds </font>= <font color="#000000">dataSet1</font>.<font color="#000000">GetChanges</font>();
<font color="#0000FF">if </font>(<font color="#000000">ds </font>!= <font color="#000000">null</font>)
{
<font color="#000000">DialogResult result </font>= <font color="#000000">MessageBox</font>.<font color="#000000">Show</font>(<font color="#0000FF">this</font>,
<font color="#FFFFFF"> </font><font color="#FF8000">"Would you like to save " </font>+ <font color="#000000">datafile </font>+ <font color="#FF8000">" ?"</font>, <font color="#FF8000">"Confirm save file..."</font>,
<font color="#000000">MessageBoxButtons</font>.<font color="#000000">YesNoCancel</font>, <font color="#000000">MessageBoxIcon</font>.<font color="#000000">Question</font>);
<font color="#0000FF">switch </font>(<font color="#000000">result</font>)
{
<font color="#0000FF">case </font><font color="#000000">DialogResult</font>.<font color="#000000">Yes</font>:
<font color="#000000">SaveXml</font>(<font color="#000000">datafile</font>);
<font color="#0000FF">break</font>;
<font color="#0000FF">case </font><font color="#000000">DialogResult</font>.<font color="#000000">No</font>:
<font color="#0000FF">break</font>;
<font color="#0000FF">case </font><font color="#000000">DialogResult</font>.<font color="#000000">Cancel</font>:
<font color="#000000">e</font>.<font color="#000000">Cancel </font>= <font color="#0000FF">true</font>;
<font color="#0000FF">break</font>;
}
}
<font color="#000000">base</font>.<font color="#000000">OnClosing</font>(<font color="#000000">e</font>);
}
</font> SaveXml() is just a method I have to save the XML and datafile is a string that is the file's full path and name.
Hope this helps
[edit] I just realize its almost the same, except perhaps that you are using the event rather than overriding, and that you call GetChanges(). Never did try that How do you persist (load/save) the dataset anyways? Are you not calling AcceptChanges somewher in between, that would cause it to return false more than often. I call AcceptChanges only one after I have read the XML from a file.[/edit]
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Hi,
thank you, but it looks more like a workaround ,)
ok, i have to call AcceptChanges after i load the dataset from disk. These resets the interal dirty state to false. Now the user edit some values in the datagrid (HasChanges() should now return true), he close the form, OnClosing i ask him to save (checked by HasChanges), he AcceptChanges or reject changes ?
that's the way i would like to get this done. What i'm doing wrong ?
.:Greets from Jerry Maguire:.
|
|
|
|
|
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (dataSet11.HasChanges())
{
switch ( MessageBox.Show("Do you wish to save your changes made for bla bla?" , "Save", MessageBoxButtons.YesNoCancel))
{
case DialogResult.Yes:
this.sqlDataAdapter1.Update(this.dataSet11);
break;
case DialogResult.No:
break;
case DialogResult.Cancel:
e.Cancel = true;
break;
}
}
}
|
|
|
|
|
Hi,
i do not use a SqlDataAdapter, the dataset is a class member. If i store the dataset to disk or to SqlDatabase, it's quite easy, cause i've i do not call a Save method, nothing happens, being updated.
Otherwise if the dataset is in a class, and the class.DataSet is bound to a datagrid, it's harder
.:Greets from Jerry Maguire:.
|
|
|
|
|
I have an XPathNodeIterator and I've been crawling through an dom tree reading in information. What I want to do is, given a node or attribute, I want an xpath expression that refers to that node.
So in other words, the opposite of XPathNavigator.Evaluate(). I want a method that takes a node and returns a string that says "/html/body/table[2]/tr[4]/td"
Is there anything built in like that? making it myself would be a pain.
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
Not that I know of. You can iterate backwards through the document and build
/html/body/table/tr/td
but to get the index, you'd have to iterate through the children at the same level, and try to figure out which was yours.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
Hi, Coders
I have the following problem:
I am overriding a TabControl class in order to make his appearance better.
It worked just fine till I decided to implement the scrolling of the tabs - I can't get rid of the scrolling buttons windows is displaying. I tried overriding almost every virtual method and adding " Invalidate() " to it, but the scrolling buttons don't care - they still are visible
Any sugestion of how I can remove them?
Cheers,
Gogou
GAtanasov
|
|
|
|
|
There was just during the last week an article on this. Look VS.NET treeview. Get some tips from that code, or ask the author.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Hi, leppie
Seems to me you just haven't got my problem...
I am NOT trying to derive new tab control form user control (In the VS.NET TabControl article, if you meant this, the author did that) but rather to inherit from TabControl class.
Btw I tried to find smthing like " VS.NET treeview " but had no success
Cheers
Gogou
GAtanasov
|
|
|
|
|
In additon to displaying checked/unchecked states in a treeview, I also need to display a third state in a Windows Form to indicate a partial selection of child nodes... Something like a "/" or "X" character in the checkbox for the third state...
can someone tell me the best way to do this?
thanks.
|
|
|
|
|
I would use an image list instead of the built-in check boxes. One image for each state, and you'll need to do some interop (SendMessage(TVM_HITTEST, ...)) in order to know that the user just clicked on the image.
|
|
|
|
|
Does anyone know where I can find an example of a function which recursively searches through a directory, and its subdirectories, for all files with a certain extension, and then returns an array of FileInfo objects for each of these files?
Mark Sanders
sanderssolutions.com
|
|
|
|
|
This is my search function:
public void FindDoc(string pathfile)
{
DirectoryInfo info = new DirectoryInfo(pathfile);
foreach (FileInfo f in info.GetFiles())
{
find(f);
}
foreach (DirectoryInfo d in info.GetDirectories())
{
foreach (FileInfo f in d.GetFiles())
{
find( f );
}
FindDoc(d.FullName);
}
}
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
find(f)? where is that defined?
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|