|
Thank's Shajeel,
But I don't want to use all this ActiveX elements from the COM components.
Can we find a better simpler code for .Net 2.0?
best regard
Adiphe
"...all is simple, but there is always simpler ..."
|
|
|
|
|
try this
System.Diagnostics.Process.Start("C:\\Windows\\System32\\rundll32.exe", " shell32.dll,Control_RunDLL inetcpl.cpl,,0");
Shajeel
|
|
|
|
|
Thank's a lot Shajeel for your reply!
I have try it, also with
System.Diagnostics.Process.Start("rundll32.exe", " shell32.dll,Control_RunDLL inetcpl.cpl,,0");
Both are realy very simple and it's work!
Thanks
best regard
Adiphe
"...all is simple, but there is always simpler ..."
|
|
|
|
|
i wanna clone a mdi child form when user click the "clone" button.
How can i do ?
|
|
|
|
|
There is no simple function in the framework to do this. Thus you will have to make it yourself. If you give some further informations on what is contained in your form whe might be able to give you some advice on how to start.
Generally speaking you will have to create a new instance of the form and copy everything what is not generated in the constructor/InitializeComponent from the old to the new form.
|
|
|
|
|
i'm having problems with treeview updating.
i'm trying to redraw the tree so that it reflects an ArrayList of servers and devices. below is my code.
sorry about the parsing. will try to come back and fix it up.
public void TreeRefresh()
{
this.m_tvTree.BeginUpdate();
this.m_tvTree.ExpandAll();
PruneTreeBranches();
GrowTreeBranches();
this.m_tvTree.ExpandAll();
this.m_tvTree.EndUpdate();
}
private void PruneTreeBranches()
{
TreeNode tn = this.m_tvTree.TopNode;
while(tn != null)
{
if(tn.Tag.ToString().IndexOf("s") == 0)
{
string ip = tn.Tag.ToString().Substring(2);
CServer server = m_Servers.GetServer(ip);
if(server == null)
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
}
else if(tn.Tag.ToString().IndexOf("d") == 0)
{
string ip = tn.Tag.ToString().Substring(4);
CServer server = m_Servers.GetServer(ip);
if(server == null)
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
int port = Convert.ToInt32(tn.Tag.ToString().Substring(2,1));
CDevice device = server.FindDevice(port);
if(device == null)
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
}
else
{
DeleteTreeNode(tn);
tn = this.m_tvTree.TopNode;
continue;
}
tn = tn.NextVisibleNode;
}
}
private void DeleteTreeNode(TreeNode tn)
{
this.m_tvTree.Nodes.Remove(tn);
}
private void GrowTreeBranches()
{
if(this.m_bShowServers)
{
for(int ii = 0; ii < m_Servers.Count; ii++)
{
CServer server = (CServer)m_Servers[ii];
GrowServerBranch(server);
}
}
else
{
for(int ii = 0; ii < m_Servers.Count; ii++)
{
CServer server = (CServer)m_Servers[ii];
for(int jj = 0; jj < server.Devices.Count; jj++)
{
CDevice device = (CDevice) server.Devices[jj];
TreeNode dn = GrowDeviceBranch(device, server.IpAddress);
if(IsNew(dn.Tag.ToString()) == null)
this.m_tvTree.Nodes.Add(dn);
}
}
}
}
private void GrowServerBranch(CServer server)
{
TreeNode tn = IsNew("s "+server.IpAddress);
if(tn == null)
{
tn = new TreeNode();
tn.Tag = "s " + server.IpAddress;
tn.SelectedImageIndex = 5;
tn.ImageIndex = 5;
this.m_tvTree.Nodes.Add(tn);
}
if(server.ServerAlias == server.DefaultAlias)
tn.Text = server.ServerAlias + ": " + server.IpAddress;
else
tn.Text = server.ServerAlias;
for(int ii = 0; ii < server.Devices.Count; ii++)
{
TreeNode dn = GrowDeviceBranch((CDevice)server.Devices[ii], server.IpAddress);
if(IsNew(dn.Tag.ToString()) == null)
tn.Nodes.Add(dn);
}
}
private TreeNode GrowDeviceBranch(CDevice device, string ip)
{
TreeNode tn = IsNew("d "+device.Port+" "+ip);
if(tn == null)
{
tn = new TreeNode();
tn.Tag = "d "+ device.Port + " " + ip;
}
tn.Text = device.Manufacturer + " - " + device.ModelNumber;
tn.SelectedImageIndex = device.Status.Status;
tn.ImageIndex = device.Status.Status;
return tn;
}
private TreeNode IsNew(string mCheck)
{
TreeNode tn = this.m_tvTree.TopNode;
while(tn != null)
{
if(tn.Tag.ToString() == mCheck)
return tn;
tn = tn.NextVisibleNode;
}
return null;
}
|
|
|
|
|
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.
|
|
|
|