Click here to Skip to main content
15,919,931 members
Home / Discussions / C#
   

C#

 
AnswerRe: numeric conversion for if check Pin
J4amieC26-May-06 2:51
J4amieC26-May-06 2:51 
GeneralRe: numeric conversion for if check Pin
Mairaaj Khan26-May-06 19:35
professionalMairaaj Khan26-May-06 19:35 
AnswerRe: numeric conversion for if check [modified] Pin
V.26-May-06 4:52
professionalV.26-May-06 4:52 
GeneralRe: numeric conversion for if check [modified] Pin
J4amieC26-May-06 5:12
J4amieC26-May-06 5:12 
GeneralRe: numeric conversion for if check [modified] Pin
V.26-May-06 5:42
professionalV.26-May-06 5:42 
GeneralRe: numeric conversion for if check [modified] Pin
J4amieC26-May-06 10:02
J4amieC26-May-06 10:02 
GeneralRe: numeric conversion for if check [modified] Pin
V.26-May-06 10:06
professionalV.26-May-06 10:06 
GeneralRe: numeric conversion for if check [modified] Pin
Mairaaj Khan26-May-06 19:39
professionalMairaaj Khan26-May-06 19:39 
AnswerRe: numeric conversion for if check Pin
Robin Panther26-May-06 11:55
Robin Panther26-May-06 11:55 
GeneralRe: numeric conversion for if check Pin
Mairaaj Khan26-May-06 19:43
professionalMairaaj Khan26-May-06 19:43 
Questionhelp for inserting data to msaccess ? Pin
cmpeng3426-May-06 2:03
cmpeng3426-May-06 2:03 
AnswerRe: help for inserting data to msaccess ? [modified] Pin
rah_sin26-May-06 2:06
professionalrah_sin26-May-06 2:06 
QuestionCustom control - configuration in desing time Pin
kamarchand26-May-06 1:30
kamarchand26-May-06 1:30 
QuestionShow Internet Optiions Dialog with C# [modified] Pin
Adiphe26-May-06 0:55
Adiphe26-May-06 0:55 
AnswerRe: Show Internet Optiions Dialog with C# [modified] Pin
Shajeel26-May-06 1:32
Shajeel26-May-06 1:32 
GeneralRe: Show Internet Optiions Dialog with C# [modified] Pin
Adiphe26-May-06 1:38
Adiphe26-May-06 1:38 
AnswerRe: Show Internet Optiions Dialog with C# [modified] Pin
Shajeel26-May-06 2:24
Shajeel26-May-06 2:24 
GeneralRe: Show Internet Optiions Dialog with C# [modified] Pin
Adiphe26-May-06 2:47
Adiphe26-May-06 2:47 
QuestionCLONE FORM Pin
Greeky26-May-06 0:52
Greeky26-May-06 0:52 
AnswerRe: CLONE FORM Pin
Robert Rohde26-May-06 1:49
Robert Rohde26-May-06 1:49 
Questionduplicate items in treeview [modified] Pin
lushgrass26-May-06 0:34
lushgrass26-May-06 0:34 
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;
}
QuestionShowing and hiding controls [modified] Pin
travellermania26-May-06 0:27
travellermania26-May-06 0:27 
AnswerRe: Showing and hiding controls Pin
Larantz26-May-06 0:34
Larantz26-May-06 0:34 
GeneralRe: Showing and hiding controls Pin
travellermania26-May-06 0:49
travellermania26-May-06 0:49 
GeneralRe: Showing and hiding controls Pin
Robert Rohde26-May-06 1:46
Robert Rohde26-May-06 1:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.