private void OnBoatMenuClick(object sender, EventArgs e) { Button btn = default(Button); SqlDataAdapter da; SqlDataReader dr = default(SqlDataReader); btn = (Button)sender; DataTable dtboat = new DataTable(); string sqlboat = "Select boatID, boatName,boatStatus, boatPicture from tb_boat where boatID = '" + System.Convert.ToString(btn.Tag) + "'"; SqlCommand cm = new SqlCommand(sqlboat, ConstVar.connect.DatabaseConnection(ConstVar.constr)); string boatID = ""; string boatName = ""; string boatstatus = ""; string boatpath = ""; dr = cm.ExecuteReader(); dr.Read(); //Asign Value boatID = dr[0].ToString(); boatName = dr[1].ToString(); boatstatus = dr[2].ToString(); boatpath = dr[3].ToString(); txtBoatID.Text = boatID; btRefresh.Tag = boatstatus; txtBoatName.Text = boatName; //MsgBox(boatID) //MsgBox(boatName) //MsgBox(boatstatus) //MsgBox(boatpath) // Check Value if (string.IsNullOrEmpty(boatpath)) { ptbBoat.Image = null; } else { ptbBoat.Image = Image.FromFile(boatpath); } if (boatstatus == "ວ່າງ") { // btChooseBoat.Enabled = True btView.Visible = false; } else if (boatstatus == "ບໍ່ວ່າງ") { btView.Visible = true; btView.Text = "View Service"; // btChooseBoat.Enabled = False } else if (boatstatus == "ຈອງແລ້ວ") { //btChooseBoat.Enabled = False btView.Visible = true; btView.Text = "View Reserve"; } FlowLayoutPanel1.Refresh(); }
private void SetPath(string path) { if (String.IsNullOrEmpty(path)) { throw new ArgumentNullException("path"); } if (String.IsNullOrEmpty(Separator)) { throw new ArgumentNullException("separator"); } FlowLayoutPanel1.SuspendLayout(); try { // remove all items for (int i = FlowLayoutPanel1.Controls.Count - 1; i >= 0; i--) { Control control = FlowLayoutPanel1.Controls[i]; if (control is LinkLabel) { (control as LinkLabel).LinkClicked -= new LinkLabelLinkClickedEventHandler(LinkLabel_LinkClicked); } FlowLayoutPanel1.Controls.Remove(control); control.Dispose(); } // add items string[] spl = path.Split(this._TreeView.PathSeparator.ToCharArray()); string t = string.Empty; for (int i = 0; i <= spl.Length - 1; i++) { // add a separator label if (i > 0) { Label label = new Label(); label.Text = this._separator; label.Margin = new Padding(0); label.AutoSize = true; FlowLayoutPanel1.Controls.Add(label); t += this._TreeView.PathSeparator; } // add link t += spl[i]; Label link; if (i == spl.Length - 1) { link = new Label(); } else { link = new LinkLabel(); (link as LinkLabel).LinkClicked += LinkLabel_LinkClicked; link.Tag = t; } link.Text = spl[i]; link.Margin = new Padding(0); link.AutoSize = true; FlowLayoutPanel1.Controls.Add(link); } } finally { FlowLayoutPanel1.ResumeLayout(); } }