|
|
public int MyAdditionFunction(params int [] values)
{
int total = 0;
foreach(int i in values)
total += i;
return total;
}
usage:
Console.WriteLine(MyAdditionFuntion(1,2,3,4,5));
|
|
|
|
|
How can we show a child form in the MDI form?
I have set the IsMdiContainer proprty of main form to true.
Now I cannot any such kind of propert (like in VB we set MDIChild property of child form to true) so that I can show the child form within the boundaries of Main Form.
I am new to Windows Forms
Thanks,
Sandeep
+919891027854
|
|
|
|
|
Set the MDIParent property of the child form to the parent form.
e.g
//suppose the code is in the parent form
//so "this" keyword represent your MDI container
MDIChild mdiChild = new MDIChild();
mdiChild.MDIParent = this;
mdiChild.Show();
On the other hand you could provide parent as a parameter in the constructor of the child in order to automate the process and set there the MDIParent property
|
|
|
|
|
Thanks for ur reply. I have one more query from u.........
How can we set the MDIParent of the child form which we had made dialog modal (eg. Login Form if I had called it by ShowDialog() method)
Thanks,
Sandeep
+919891027854
|
|
|
|
|
You can't.Only non-modal and non-TopMost windows can be set as child.
|
|
|
|
|
|
Probably installing XP SP2?
|
|
|
|
|
how could i install xp sp2 to windows me?
|
|
|
|
|
Buy a windows XP disk.
|
|
|
|
|
I mean installing xp sp 2 onto win ME.
I know it is impossible
|
|
|
|
|
What, upgrading Windows ME to XP?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
No
I used MaskedTextBox in my project it works fine on XP machines. But at Windows ME clients it doesnt work. so i asked is there any method to force to work it on Windows me. But i read MSDN carefully, i relazed, maskedbox is a WinFx control so WinFx controls just works on XP with SP2 , and WinServer 2003 also Vista.
All is that.
I decided to use MSMASK32.OCX i add to tollbar, but it says now "YOU MUST HAVE A LICENCE TO THIS THIS aCTIVEx COMPONENT"
how can i register that ? regsvr ... ... ???
|
|
|
|
|
You can try unregistering and re-registering the control using REGSVR32.
If that doesn't work, see this[^] KB article on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Reflection
i have this class
class A
{
public int a
}
now this is what i want to do in my method
private A copy(A first)
{
A second as new A()
now i want to copy all values from "first" tot "second" , like this i mean:
second.a = first.a
but on this way i don't want to work, when a new member is added, i always have to adjust this function
so i want to loop all members with reflection and then copy the value like this:
Type typea = Type.GetType("A")
For Each member As System.Reflection.MemberInfo In typeA.GetMembers(Reflection.BindingFlags.DeclaredOnly)
'and here i want something like this: (offcourse this doesn't work)
second.member.name.value = first.member.name .value --> how can i get something that does this with reflection
Next
}
|
|
|
|
|
Why not use the method MemberwiseClone?
---
b { font-weight: normal; }
|
|
|
|
|
yezz i also tought of that but what will happen with arrays of reference types?
class A
{
public z = new Z[4]
}
class Z
{
public h = new H[3]
}
class H
{
public int i
}
how does memberwizeclone clone this? my new object may not referece to the same objects, never!! because i will change some values, and my source object may not change along with it
|
|
|
|
|
Then you have to loop through the members of the class and create a copy of each member that is a reference type. The code has to handle all data types that you will be using in the class.
I would have let the class implement IClonable instead.
---
b { font-weight: normal; }
|
|
|
|
|
can't do, i don't have control over the class, i'm only using it
so i think the only way doing this is with reflection, so if someone knows how i have to code this, please
|
|
|
|
|
is there any property for writing something to masked textbox without deleting what it includes.
Like YOU CLICKED INSERT KEY
|
|
|
|
|
in a project i used maskedtextbox, i am using .net FW beta 2 . In XP computers there is no problem, but at Windows ME computers have problem.
Problem is When u enter maskedtextbox -while using directionb keys- cursor isnt gone where u want to take it.
|
|
|
|
|
Hi all,
I am developing an Editor on Japanese XP and want to provide text formatting in the editor.
I provided a comboBox to select the Font. i have included some Japanese fonts such as MS Gothic, SimSin, SimHei etc..
Now the problem i am facing is when i change the font from the ComboBox the font is not changed i.e the change is not reflected
The text entered after changing the font has the default font instead of the new font that is selected.
any help will be appreciated
Thanks and Regards,
Pramod
|
|
|
|
|
Yadav Pramod wrote: i.e the change is not reflected
Did you provide code for the combobox' itemChange event? If yes, what code did you write in there?
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
This is in the selectionChanged event of the ComboBox
{
RichTextBoxEx temp = focused; //focused is the RichtextBox that is currently focused
if(temp.SelectionFont != null)
temp.SelectionFont = new Font(((ComboBox) sender).Text,
.SelectionFont.SizeInPoints,temp.SelectionFont.Style);
else
temp.Font = new Font(((ComboBox)sender).Text,
temp.Font.SizeInPoints,temp.Font.Style); temp.Focus();
}
Please reply if u have some solution
Thanks and Regards
Pramod
|
|
|
|
|
Hmm... you said you're using Japanese font families. Are they installed on your machine? A simple way to find out if they are indeed, is to fire notepad and see if you can use them to write something. If not, I think that's ur problem.
I've tried adding a richTextBox and a combo on a form with the code below and works fine. Notice that in the form's load event, I get only the installed fonts on my machine, and use one of them to apply to my richTextBox:
private void Form1_Load(object sender, System.EventArgs e)
{
foreach (FontFamily f in FontFamily.Families)
this.comboBox1.Items.Add(f.Name);
this.comboBox1.SelectedIndex = 0;
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.richTextBox1.Font = new Font(this.comboBox1.Text, 10);
}
Regards,
Polis
Can you practice what you teach?
-- modified at 7:44 Friday 9th December, 2005
|
|
|
|