private void LbxUsername_SelectedIndexChanged(object sender, EventArgs e) { if (LbxUsername.SelectedItem.ToString() != null) { string username = LbxUsername.SelectedItem.ToString(); cDatabase db = new cDatabase(); cQuery qr = new cQuery(); DataTable dtUser = db.selectData(qr.qSelectUserWhereUsername(username), '1'); if (dtUser.Rows.Count != 0) { foreach (DataRow row in dtUser.Rows) { txt_username.Text = row["username"].ToString(); txt_fullname.Text = row["fullname"].ToString(); txt_password.Text = row["password"].ToString(); combo_role.SelectedItem = row["role"].ToString(); if (row["aplication"].ToString() == "Biro Umum") { rbKantor.Checked = true; } else if (row["aplication"].ToString() == "Gate") { rbGate.Checked = true; } } } } }