void Read_hostCombo() { try { //ラベルに反映 if (m_siteCombo.SelectedValue != null) { m_siteno.Text = m_siteCombo.SelectedValue.ToString(); } m_hostCombo.DataSource = null; m_hostno.Text = ""; Class_Detaget getuser = new Class_Detaget(); //ホスト名を検索 List <hostDS> hostDSList = getuser.getHostList(m_siteno.Text, con, true); //空白行を追加 hostDS tmp = new hostDS(); tmp.hostname = ""; tmp.host_no = ""; List <hostDS> tmphostDSList = new List <hostDS>(); tmphostDSList.Add(tmp); //取得した行を空行についか if (hostDSList != null) { tmphostDSList.AddRange(hostDSList); } m_hostCombo.DataSource = tmphostDSList; m_hostCombo.DisplayMember = "hostname"; m_hostCombo.ValueMember = "host_no"; //ホスト名ラベルを表示 if (hostDSList.Count > 0) { if (m_hostCombo.Text != "") { m_hostno.Text = m_hostCombo.SelectedValue.ToString(); } } } catch (Exception ex) { MessageBox.Show("ホストコンボボックスの一覧を取得することができませんでした。 " + ex.Message, "ホスト情報取得"); } }
//ホスト名を読み込む private void Read_hostCombo(string siteno) { m_hostCombo.DataSource = null; m_hostno.Text = ""; Class_Detaget getuser = new Class_Detaget(); //ホスト名を検索 List <hostDS> hostDSList = getuser.getHostList(siteno, con, true); m_hostCombo.DataSource = hostDSList; m_hostCombo.DisplayMember = "hostname"; m_hostCombo.ValueMember = "host_no"; //ホスト名ラベルを表示 if (hostDSList.Count > 0) { m_hostno.Text = m_hostCombo.SelectedValue.ToString(); } }
//ホスト名を読み込む private void Read_hostCombo(string siteno) { try { m_hostCombo.DataSource = null; m_hostno.Text = ""; Class_Detaget getuser = new Class_Detaget(); //ホスト名を検索 //空白行を追加 hostDS tmp = new hostDS(); tmp.hostname = ""; tmp.host_no = ""; List <hostDS> hostDSList = new List <hostDS>(); hostDSList.Add(tmp); //リストの取得 List <hostDS> hostDSList1 = getuser.getHostList(siteno, con, true); hostDSList.AddRange(hostDSList1); m_hostCombo.DataSource = hostDSList; m_hostCombo.DisplayMember = "hostname"; m_hostCombo.ValueMember = "host_no"; //ホスト名ラベルを表示 if (hostDSList.Count > 0) { m_hostno.Text = m_hostCombo.SelectedValue.ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ホスト情報の読み込みに失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }