|
I have an application that has 3 panels one on top of the other.
Each panel contains several control.
I also have a toolbar that I am using to navigate between the panels using the SendToBack() and BringToFront() methods and with the Hide() and Show() methods.
For some reason when I want to show the the 3rd panel, I get the controls of the first panel together with the 3rd panel.
This problem doesn't happen when I display the 2nd panel or the first panel.
Help will be appreciated.
Topaz
P.S.
this is the code:
switch(e.Button.Text)
{
case "Option 1":
this.panelOption2.SendToBack();
this.panelOption3.SendToBack();
this.panelOption1.BringToFront();
this.panelOption1.Show();
this.panelOption2.Hide();
this.panelOption3.Hide();
break;
case "Option 2":
this.panelOption1.SendToBack();
this.panelOption3.SendToBack();
this.panelOption2.BringToFront();
this.panelOption2.Show();
this.panelOption3.Hide();
break;
case "Option 3":
this.panelOption2.Show();
this.panelOption2.SendToBack();
this.panelOption1.SendToBack();
this.panelOption3.BringToFront();
this.panelOption3.Show();
break;
default:
break;
}
<pre>
-- modified at 6:31 Friday 26th May, 2006
|
|
|
|
|
In Windows Form Designer generated code
you find the "panelOption3.Controls.Add(someControl);" etc.
Have you checked to see that your buttons in panelOption1 isn't also added to panelOption3?
Sounds like it since they show for both panels.
-Larantz-
|
|
|
|
|
Panel1 is added to the From
panel 2 is added to panel 1
panel 3 is added to panel 2
I checked and all controls that should be on panel1 are where they should be.
The same is true for controls of Panel2 & Panel3
|
|
|
|
|
Given this info the solution I posted will surely not work. I thought all panels were placed on the same container control. Is there any reason why you are placing within each other?
|
|
|
|
|
Robert,
You were right, I was wrong to put the panels one on top of each other instead of puting them on the form itself.
Thanks a lot for your time.
Thanks also to theRealCondor and Larantz
Toapz
-- modified at 3:44 Saturday 27th May, 2006
|
|
|
|
|
You should recheck what Larantz suggested but you can also make your life a bit easier:
this.panelsOption1.Visible = e.Button.Text == "Option 1";
this.panelsOption2.Visible = e.Button.Text == "Option 2";
this.panelsOption3.Visible = e.Button.Text == "Option 3";
|
|
|
|
|
It's hard to explain...but I get a bad feeling about what you are trying to do here. If you want to have an area that dynamically changes, I'd recommend a somewhat different approach that more cleanly fits into the windows paradygm.
What I would do is to have a single panel. Each set of controls would be removed from the form and created as individual UserControl objects. When the need comes to show the different view, clear the controls in the panel and create/add the required user controls. You can modify the constructor of the controls passing whatever data is needed to initialize the view.
If you find that the controls don't sit just right in the panel you can add some logic such as this:
panel.Controls.Add( functionControl );
functionControl.Docking = Docking.Full;
form1.Invalidate();
So you add the control, dock it so it fills the panel, then invalidate the form to get the new control visible.
|
|
|
|
|
I have found a ListView control on the web that has been extended to include additional functionality. Unfortunately it now has a problem. When you click on a ListViewItem it does not select it. i.e. it does not highlight the item like it would normally in a normal ListView control.
Could you tell me what events and methods I should change to make it select an item when the user clicks on one item?
Much appreciated.
|
|
|
|
|
Can you provide a link to the ListView control as they can vary greatly?
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
hi all,
DataTable dset2 = new DataTable();
OleDbDataAdapter adp2;
adp2 = new OleDbDataAdapter("Select password From Users Where username = " + "\"" + textBox1.Text + "\"", conn);
adp2.Fill(dset2);
how will i check passwords in database with the one entered ?
if (dset2.Rows[i].ToString()==textBox2.Text) ???
how can i get passwords in dset ? help please ...
|
|
|
|
|
DataTable dset2 = new DataTable();<br />
OleDbDataAdapter adp2;<br />
adp2 = new OleDbDataAdapter("Select password From Users Where username = '" + textBox1.Text + "'", conn);<br />
adp2.Fill(dset2);<br />
if (dset2.Rows.count > 0)<br />
{<br />
}<br />
else<br />
{<br />
}
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:00am.
|
|
|
|
|
You can find the data in the rows and columns i.e like this:
string pwd = dset2.Rows[i].ItemArray[i].ToString();
Since you're asking for password for one specific user, you can do this:
string pwd = dset2.Rows[0]["Password"].ToString();
string pwd = dset2.Rows[0].ItemArray[0].ToString();
-Larantz-
|
|
|
|
|
Hi,
I need help with writing code to call the NetFileEnum and NetFileClose functions from the NetAPI32.dll using C#.
Basically am trying to enumerate open file connections on a network resource and be able to close those connections similiar to the Computer Management MMC snapin Shared Folders>Open Files.
Thanks in advance...
|
|
|
|
|
hi, all.
how can i get the time 'exactly' in this format : 5/26/2006 12:59:59 AM
lblLoginTime.Text = Convert.ToDateTime(DateTime.Now.Date.ToString()).ToString("MM/dd/yyyy hh:mm:ss");
this just gives me : 5/26/2006 00:00:00 ???
where am i doing wrong ?
|
|
|
|
|
Hi,
Do like this:
DateTime.Now.ToString()).ToString("MM/dd/yyyy hh:mm:ss")
Hope this help you.
Best Regards,
Apurva Kaushal
|
|
|
|
|
try to use
lblLoginTime.Text = Convert.ToDateTime(DateTime.Now.Date.ToString()).ToString("MM/dd/yyyy"+" "+Convert.ToDateTime(DateTime.Now.TimeOfDay.ToString()).ToString("HH:mm:ss")
rahul
|
|
|
|
|
This code gives this result
MM/dd/yyyyHH:mm:ss
whithout space between Date and Time
|
|
|
|
|
Message Closed
modified 27-Apr-15 11:00am.
|
|
|
|
|
Custom DateTime Format Strings[^]
"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." - Rick Cook
www.troschuetz.de
|
|
|
|
|
try to use
lblLoginTime.Text = Convert.ToDateTime(DateTime.Now.Date.ToString()).ToString("MM/dd/yyyy"+" "+Convert.ToDateTime(DateTime.Now.TimeOfDay.ToString()).ToLongTimeString();
rahul
|
|
|
|
|
Just following your logic makes my brain ache!
DateTime.Now -> returns an instance of DateTime.
.Date -> gets JUSt the date part
.ToString() converts the DateTime instance to a string according to your PC settings
then:
Convert.ToDateTime(DateTime.Now.Date.ToString()) --> Convert a DateTime to a striing, then convert that string back to a dateTime..
and finally
ToString("MM/dd/yyyy hh:mm:ss") --> convert the whole lot back to a string.
How on earth did you come up with such a convoluted way of doing it? The reason you were getting just the date and 00:00:00 as the time is bacause thats exactly what you asked for by callin .Date on DateTime.Now
All you needed was:
DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")
and you would have got todays date and time in your required format.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi,
I have made a installer of My Windows Application (C# 2005 Express) and ported my software to a different computer. my installer installes SQL Server 2005 Express in the target machine at first then copy my software. When I installed the software in that computer and I clicked to run, I got the following error message and Program shut down.
.........................................................................
An error has occured while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the fact
that under the default settings SQL Server does not allow remote
connections. (Provider: SQL Netowrk Interfaces, error:26 - Error locating
Server/Instance specified.)
..........................................................................
Would you please guide me about this problem. Why it is looking for remote connection, It is not something like ASP.NET connecting thru Website or something like that. it is the very mdf file which is already available in the same PC and it should be accesssible thru the connection string I programmed in the application, right ?
Thanks and regards
Emran
|
|
|
|
|
Sounds like the SQL server isn't configured to allow incoming calls.
I'm not familiar with SQL Server 2005, but Oracle needs to have listenerservices running.
Might be a similar thing.
-Larantz-
|
|
|
|
|
Please help me...
I'd like to implement a depth first search method..
Or breadth first search,or both of them.
Please help me quickly...
|
|
|
|