private void simpleButton2_Click(object sender, EventArgs e) { int[] rowIndex = gridViewNick.GetSelectedRows(); DataRow CurrentRow = gridViewNick.GetDataRow(rowIndex[0]); int room_id = Convert.ToInt16(CurrentRow["room_id"]); UpdatePanel = new XtraMessageBoxForm(); UpdatePanel.StartPosition = FormStartPosition.CenterScreen; BasicInfoTelephoneUpdate UserControl = new BasicInfoTelephoneUpdate(room_id); UpdatePanel.Width = (UserControl.Width + 16); UpdatePanel.Height = UserControl.Height; UpdatePanel.Controls.Add(UserControl); UpdatePanel.Show(); }