public void SetDataBind_treeView1() { treeView1.Nodes.Clear(); M_WsCodeTMainDB.WsCodeTMainDB wSvc = null; string reCode = ""; string reMsg = ""; M_WsCodeTMainDB.DataCodeTSiteTreeView[] getData1 = null; try { wSvc = new M_WsCodeTMainDB.WsCodeTMainDB(); wSvc.Url = "http://" + AppInfo.SsWsvcServer2 + "/WebSvc/Sys/CodeT/WsCodeTMainDB.svc"; wSvc.Timeout = 1000; ImageList myimageList = new ImageList(); myimageList.Images.Add(Image.FromFile(@"Image\treeicon1.png")); treeView1.ImageList = myimageList; treeView1.ImageIndex = 0; reCode = wSvc.sCodeTSiteTreeView(AppInfo.SsDbNm, AppInfo.SsSiteCd, AppInfo.SsLabAuth, out getData1, out reMsg); if (reCode == "Y") { if (getData1 != null && getData1.Length > 0) { for (int j = 0; j < getData1.Length; j++) { string ccode_val = getData1[j].CCODE.ToString(); string ccodeNm_val = getData1[j].CCODE_NM.ToString(); TreeNode root = new TreeNode(); root.Tag = ccode_val; root.Text = ccodeNm_val; treeView1.Nodes.Add(root); if (treeView1.Nodes.Count > 0) { treeView1.SelectedNode = treeView1.GetNodeAt(0, 0); } } treeView1.ExpandAll(); } } } catch (Exception ex) { logs.SaveLog("[error] (page)::FrmCodeTSite.cs (Function)::SetDataBind_treeView1 (Detail):: " + "\r\n" + ex.ToString(), "Error"); } finally { if (wSvc != null) { wSvc.Dispose(); } } }