|
|
hi friends,please help me. i have written code for into mdi form for openning a child form.
private void menuItem7_Click(object sender, System.EventArgs e)
{
frmBaseForm frmLoad= new frmBaseForm();
frmLoad.MdiParent =this;
frmLoad.Left =0;
frmLoad.Top =0;
frmLoad.Show();
}
when i click menu more then once,this code open more then one form.
i don't want that. it can be solve by using variable and may be enabling disabling the menu item. but i want optimum solution
thnx a lot
|
|
|
|
|
Use this function...if it suits you...
frmBaseForm frmLoad= new frmBaseForm();
ShowMdiChild(frmLaod);
private void ShowMdiChild(Form frm)
{
if(frm==null)
return;
for(int i = 0 ; i < this.MdiChildren.GetLength(0) ; i++ )
if(this.MdiChildren[i].Name.Equals(frm.Name))
return;
//if (! this.Contains(frm))
frm.MdiParent = this;
frm.Show();
}
sorry for my bad English.
|
|
|
|
|
thnx a lot,its working fine
|
|
|
|
|
Hello,
Im' using i'm called matlab using dll ; it's clear how pass a double variables, but i can't pass a string variables, Plz how we can do it ?
|
|
|
|
|
How can i do to write an function which can:
-Trim spaces in the first, last of string and return an space in case of there are too many spaces between letters
-Upper case the first character of string an each letter of string the remain letter is lower case
for example when user input:
aBcd efG hiK
The return string is:
Abcd Efg Hik
Please help me talents.
Thanks and best regards.
I tried so hard and got so far
|
|
|
|
|
Look for the Trim function in the string class, that should help you achieve your first objective.
For the second, you can traverse the string till you hit a non space character, change that character to upper case, then change the next ocurring characters to lower case until you hit a space (or reach the end of the string). You need to use System.Text.StringBuilder for this, as the string class doesn't allow the string to be modified.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi, is it possible to configure HTML formatted message with Log4Net's SMTP appender?
Thanks.
Norman Fung
|
|
|
|
|
I have a sample class as shown below
public class MyAirport
{
delegate void ProcessAirport(string s);
ProcessAirport pa;
public MyAirport(string sAirportName)
{
pa = new ProcessAirport(ProcessMumbai);
}
private void ProcessMumbai(string s)
{
MessageBox.Show(s);
}
public void ProcessAirport()
{
pa("Hello Mumbai");
}
}
in the class above i have used created a delegate instance with statement
pa = new ProcessAirport(ProcessMumbai);
where in i am passing 'ProcessMumbai' directly as a function pointer to ProcessAirport delegate.
now my question is : can i pass function pointer referance by string like,
pa = new ProcessAirport("ProcessMumbai");
if so, please guide.
thanks,
vaibhav
|
|
|
|
|
AFAIK, you can't do that directly with delegates. You need to use reflection for that. Something like
public class MyAirport
{
delegate void ProcessAirportDelegate(MethodInfo methodInfo);
ProcessAirportDelegate pa;
public MyAirport(string airportName)
{
pa = new ProcessAirportDelegate(ProcessAirport);
}
private void ProcessAirport(MethodInfo methodInfo)
{
methodInfo.Invoke(this, new object[] {});
}
public void CallProcessMethod(string methodName)
{
MethodInfo methodInfo = this.GetType().GetMethod(methodName);
pa(methodInfo);
}
}
I created a delegate because your code had one. You can instead call methodInfo.Invoke directly from CallProcessMethod .
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
hi Senthil,
Thanks for the help. Now i have got the perfect clue. now i am not using gelegates, i am using reflection instade.
thanks,
vaibhav.
|
|
|
|
|
do u know the link of download directshow sdk?
shumyla
|
|
|
|
|
If you can't find it, you probably should not bother downloading it. The DX SDK requires more problem solving ability than typing "direct x download" into google.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi everyone
Does anybody have a rather simple code that teaches how to write a docking ToolBar in an MDI application? Please give it me. I will be very appreciated it.
Nguyen Thai Binh
|
|
|
|
|
|
1.How to get Audio & Video Stream data using Directshow?
2.How to send,replay this data on network?
shumyla
|
|
|
|
|
Okay...I've been searching for something easy in regard to the subject line but haven't found it (still looking though). In the meantime does anyone have an easy way to get a file explorer to work in a treeview? And to to make the files clickable?
Thanks!
And I must comment that I just found this web page about 2 days ago. Already it's my #1 Code page to go to. This page is great! Keep it up!!
|
|
|
|
|
|
I d/l'd that and looked it over. It's not bad but it's not what I'm looking for. The way this one is working is the files are being displayed in a different view. Why they did this I don't understand but it's functional. What I'm looking for is something that works like Windows Explorer but in a treeview box.
Thanks for the suggestion. I'm going to continue to tweak what is in that advanced file explorer...who knows, I may get it to run the way I want it too.
|
|
|
|
|
I want to intercet the ondraw event of textbox to avoid to draw the classic base with a trasparent one.
How could i do?
|
|
|
|
|
Off the top of my head, if you derive your own class from a TextBox component, you could override the OnPaint method and not call base.OnPaint. Haven't done it before though, so it may be wrong, but I believe that is what you are looking for.
|
|
|
|
|
|
Hello,
I want to port an old custom collection class that was derived from the System.Collections.CollectionBase to a new generic collection.
In the old code I've overridden the OnXXX methods of the CollectionBase to fire events when the collection was modified.
But now I see that in the new generic Collection<> class there are no such methods... Is there any workaround for this or should I implement a new generic CollectionBase from scratch?
Thanks.
|
|
|
|
|
Pedro S Ferreira wrote:
Is there any workaround for this or should I implement a new generic CollectionBase from scratch?
It looks like you'll need to implement a generic CollectionBase.
Marc
My website
Latest Articles:
Undo/Redo Buffer
Memento Design Pattern
|
|
|
|
|
There's this great article about PropertyGrid control. There is a set of classes PropertBag/PropertySpec in that article to help customize what the grid shows. Ok. Then there's idscussion about how to make comboboxes work. So the suggested way is through the UITypeEditor inhertance. And there I ask a question on how to modify the list of possible values. How to set a list of items in the listbox at "Properties.Add" time in form code instead of the contructor of that ListBoxEditor?
In other words how to get access from the contructor of the ListBoxEditor back to form so I can fill the listbox with dynamic values?
I hope it's not too confusing.
Please help! Urgent! Thanks a lot in advance!
|
|
|
|