|
A form has a Size property.
ChildForm child = new childForm();
child.MdiParent = this;
child.Size = new Size(this.Width, this.Height);
child.Show();
This will set the height and width of the child form to be the same as its parent form.
|
|
|
|
|
I get a scrollbar on the parent form because the child form seems to be too long.
Any thoughts please?
This is what I have
Form frmNew = new frmChild();
frmNew.MdiParent = this;
frmNew.Size = new Size(frmNew.Width, this.Height);
frmNew.Show();
|
|
|
|
|
frmNew.Size = new Size(frmNew.Width, this.ClientSize.Height);
|
|
|
|
|
That still gives a scrollbar.
|
|
|
|
|
Wierd, I'm sure that's how I've done it before!
This way works if you want width and height:
In your child form's load event put...
this.Dock = DockStyle.Fill;
|
|
|
|
|
It depends how you will use your child form. I cant seem to get the child form to appear within the client rectangle without scroll bars apart from hacking it. So here is a couple of options you could have a look at.
1. You can set the child forms Dock = Fill.
2. You can set the child forms WindowState = FormWindowState.Maximized.
3. You can set the childs size to parentForm.ClientRectangle - x. (hack i know)
Sorry I am all out of ideas after that. The scroll bars seem to appear no matter if i set the hscroll etc props.
|
|
|
|
|
Solved it by doing this:
frmNew.Size = new Size(frmNew.Width, this.Height - 80);
Thanks
|
|
|
|
|
You may want to check the value of this.Height before you run this line of code. Setting the size to a negative number could be detrimental to the execution of your application.
|
|
|
|
|
Ok, I've checked the code that I used in a previous project and this works fine:
this.Height = this.Parent.ClientSize.Height;
Using this.MdiParent.ClientSize.Height doesn't however - strange!
|
|
|
|
|
Is there any code in C# to get GUID of network card.
Thanks.
The great pleasure in life is doing what people say you cannot do.
|
|
|
|
|
GUID of network card? Do you mean the Mac Address? If so, you can use WMI to retrieve it:
public string GetMACAddress()
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
ManagementObjectCollection moc = mc.GetInstances();
string address = string.Empty;
foreach (ManagementObject mo in moc)
{
if (MACAddress == string.Empty)
{
if ((bool)mo["IPEnabled"] == true)
address = mo["MacAddress"].ToString();
}
mo.Dispose();
}
address = address.Replace(":", string.Empty);
return address;
}
|
|
|
|
|
Thanks Pete O'Hanlon for your reply, but i need GUID which also called UUID.
Any Idea please.
The great pleasure in life is doing what people say you cannot do.
|
|
|
|
|
Hi,
I have recently got a test server running so the employees can input test data without needing worry about if they mess up.
So I written a small c# windows app that the user runs and it has two buttons "test server" or "live server".
The problem is I want to indicate to the user what system they are in, but I cant mod the exe so can I execute the exe within a windows form app, so the exe is contained inside the windows form and I can place some text on the Form like "You are in the Test Server",
how can I get the exe to load within a form?
|
|
|
|
|
What you would have to do is set the form so that it is MDI and then use WinAPI to get the handle of the main form for the application you want to embed and set its parent (done through API) to the .NET application that you are developing.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
How can i add drop down list to datagridview for one column.
usharani
|
|
|
|
|
|
Get this[^]
------------------------------------------------------------
"The only true wisdom is in knowing you know nothing." --Socrates
|
|
|
|
|
Hi there,
I came across this strange thing, i don't know how to handle it. Maybe a pretty stupid question or a case of RTFM - but i couldn't find any refference...
Following code works just fine:
<br />
WebClient webClient = new WebClient();<br />
webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");<br />
webClient.Headers.Add("abc", "123");<br />
byte[] postArray = Encoding.UTF8.GetBytes("submitting some data here...");<br />
byte[] responseArray = webClient.UploadData("MyServer", postArray);<br />
Console.WriteLine("Response received was : " + Encoding.ASCII.GetString(responseArray));<br />
Console.Read();<br />
BUT if i change the HTTP Header to something like
webClient.Headers.Add("abc[OBJECT_ID]", "123");
i get an error in the next line (byte[] postArray...) saying:
An unhandled exception of type 'System.ArgumentException' occurred in system.dll
So it's the square brackets causing the issue. Do i need to escape them in any way???
thanks in advance,
- ajs
|
|
|
|
|
hi
i have a comboBox that binded to a field in database, and i want to add new item to my binded comboBox dynamically, how to do that ?
thanks
|
|
|
|
|
Add the item in code. Something like:
mycombo.Items.Add(mytext)
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
thanks
it's display exception, that it binded to datasource.
|
|
|
|
|
1. Add to the datasource before binding to the combobox.
|
|
|
|
|
when the user try to close the form by clicking the close button of the title bar.how can show a dialog box to verify the form closing ?
|
|
|
|
|
you will get form closing event @ that time
My small attempt...
|
|
|
|
|
in witch event ? the closed or closing event ?
|
|
|
|