473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

simple form question

Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan
Feb 1 '06 #1
4 1743
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:
Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan

Feb 2 '06 #2
Hi MadHatter

Thanks for the reply, but none of those options make any difference, the
form does not open as maximized the first time. there seems to be some
difference in the way VS2K5 works when displaying a child form compared to
VS2K3. if you haven't tried it I suggest trying my example. I have spoken to
a collegue of mine and have got them to create a sample and it doesn't work
as expected for them either (in c# or vb), though MSDN says this is how it
should work, but clearly it doesn't.

more investigation required on this to find out whats going on (I'm sure its
not a bug (well I'd be very surprised if it was))
--
Duncan
"TheMadHatter" wrote:
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:
Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan

Feb 4 '06 #3
Yello, sorry I didnt write back sooner. I had enough time
to read your responce, and test a simple app, then I had
a 24h power blackout. (stupid falling trees!!!)

Okay I just finished testing your probem, and I cant
give you a reason why it doesnt try to maximize. Perhaps
the show() method doesnt try to resize the app?

I got around this by leaving the child form's property "WindowState"
to "normal", then after I have called the myform.Show() method, I
set the form's property "WindowState" to "Maximized". This did the
trick. I cant remember how exactly it worked in 03, but that is for
another person to figure out.

Conclusion:
This may or may not be a bug, but it is easy enough to programmaticly
tell the child form to maximize, that it probably isnt worth complaining
about.
"Duncan" wrote:
Hi MadHatter

Thanks for the reply, but none of those options make any difference, the
form does not open as maximized the first time. there seems to be some
difference in the way VS2K5 works when displaying a child form compared to
VS2K3. if you haven't tried it I suggest trying my example. I have spoken to
a collegue of mine and have got them to create a sample and it doesn't work
as expected for them either (in c# or vb), though MSDN says this is how it
should work, but clearly it doesn't.

more investigation required on this to find out whats going on (I'm sure its
not a bug (well I'd be very surprised if it was))
--
Duncan
"TheMadHatter" wrote:
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:
Hi

I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
I'm just starting with a few simple examples and I've come across a problem.
I've got two forms ones an MDI parent & ones a child form.

I've put this code into a menustrip on the parent form
private void maintainClientsToolStripMenuItem_Click(object sender,
EventArgs e)
{
FrmCustomer frm = new FrmCustomer();
frm.MdiParent=this;
frm.Show();
}

when I run the application, the child form seems to be shown in the left
hand upper corner (with the top bar of the form hidden behind the parents)
even though the child form is set to be maxmized, if I click the maximize
button in the child form it resizes to a small form and maximizing it gives
the right result and all works ok.

Why doesn't this work first time in vs2005, yet the same code does in vs2003?

--
Duncan

Feb 6 '06 #4
Hi

Well They way it worked in vs2k3 was exactly that way, I might still report
even though it might not be a bug. Thanks for your help on this, I'll try
your work around.

Duncan

--
Duncan
"TheMadHatter" wrote:
Yello, sorry I didnt write back sooner. I had enough time
to read your responce, and test a simple app, then I had
a 24h power blackout. (stupid falling trees!!!)

Okay I just finished testing your probem, and I cant
give you a reason why it doesnt try to maximize. Perhaps
the show() method doesnt try to resize the app?

I got around this by leaving the child form's property "WindowState"
to "normal", then after I have called the myform.Show() method, I
set the form's property "WindowState" to "Maximized". This did the
trick. I cant remember how exactly it worked in 03, but that is for
another person to figure out.

Conclusion:
This may or may not be a bug, but it is easy enough to programmaticly
tell the child form to maximize, that it probably isnt worth complaining
about.
"Duncan" wrote:
Hi MadHatter

Thanks for the reply, but none of those options make any difference, the
form does not open as maximized the first time. there seems to be some
difference in the way VS2K5 works when displaying a child form compared to
VS2K3. if you haven't tried it I suggest trying my example. I have spoken to
a collegue of mine and have got them to create a sample and it doesn't work
as expected for them either (in c# or vb), though MSDN says this is how it
should work, but clearly it doesn't.

more investigation required on this to find out whats going on (I'm sure its
not a bug (well I'd be very surprised if it was))
--
Duncan
"TheMadHatter" wrote:
Simple answer:
On the child form in the design time, set the StartPosition property to what
ever
you want. Eg WindowsDefaultLocation, Manual, CenterScreen,
WindowsDefaultBound, or >> CenterParent <<

"Duncan" wrote:

> Hi
>
> I'm learning c# 2.0 as I feel I need to be able to switch between vb & c#,
> I'm just starting with a few simple examples and I've come across a problem.
> I've got two forms ones an MDI parent & ones a child form.
>
> I've put this code into a menustrip on the parent form
> private void maintainClientsToolStripMenuItem_Click(object sender,
> EventArgs e)
> {
> FrmCustomer frm = new FrmCustomer();
> frm.MdiParent=this;
> frm.Show();
> }
>
> when I run the application, the child form seems to be shown in the left
> hand upper corner (with the top bar of the form hidden behind the parents)
> even though the child form is set to be maxmized, if I click the maximize
> button in the child form it resizes to a small form and maximizing it gives
> the right result and all works ok.
>
> Why doesn't this work first time in vs2005, yet the same code does in vs2003?
>
> --
> Duncan

Feb 7 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Oli | last post by:
Hi Folks, Alright, I have a textbox called "A" and the value in that textbox is "B". When the user presses submit I want A : B to appear on the page. How do I do it? I appreciate that this...
7
by: r0adhog | last post by:
I have a very simple form: <html> <head> </head> <body> <% function ValForm() if len(document.form.newapp.all("AccessCode").Value) = 4 then document.form.newapp.submit()
0
by: steve w | last post by:
Hi there I'm trying to do something that in ASP I could do easily. I want a form which will... 1. Bind a record from a database to the text boxes etc. if the user has come from a summary...
13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
2
by: not | last post by:
Hello All, I am trying to develop a relatively simple self-quiz form in javascript, but I'm having no luck getting it to work. What I am looking for is a script that allow the user to select...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
1
by: adam | last post by:
I have a simple form question. I order to access a payment gateway I have a asp.net page which has to have a form that use POST for method and _blank for target. Before the information of the form...
4
by: pcnerd | last post by:
I originally asked this question in the "classic" VB forum. It occured to me after I had sent it that I sent it to the wrong forum. Anyway! Here's the situation. I have VB.NET 2005 Express...
2
by: njuneardave | last post by:
Hey, this is a simple question. I am new to the whole visual C# scene. I am creating a simple "Find Word" dialog box. I have the menu working: File -> Find -> Find Word....then it pops up my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.