Click here to Skip to main content
15,916,842 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
this is my code in form Textboxes:-
C#
public FRM_PatientData(string P_id)
       {
           InitializeComponent();

           txt_Pid.Text = P_id;
       }


this is code in form gridview:-
C#
private void dGV_Patient_DoubleClick(object sender, EventArgs e)
        {
            FRM_PatientData frm = new 
            FRM_PatientData(this.dGV_Patient.CurrentRow.Cells[0].Value.ToString());
            this.Close();
        }


What I have tried:

this code is not work only,if i show form textbox :- add ..... frm.show();
but this code will open another form textbox
Posted
Comments
Sergey Alexandrovich Kryukov 13-Feb-16 2:57am    
It makes no sense at all. Can you explain what exactly you are trying to achieve?
You create a form locally. It simply does nothing.
You don't think you are ready for UI development. It looks like you have little understanding of the very basics, what are types and instances, what constructors do, and do on...
—SA
Member 12244977 13-Feb-16 3:20am    
i want display data from gridview to another form textbox .
Richard MacCutchan 13-Feb-16 4:37am    
You need to understand the concept of classes and objects first. Creating a new FRM_PatientData form in the datagridview click method is not the way to do it. You need a reference to the original form.
Member 12244977 13-Feb-16 4:50am    
this ismy code in form gridview :-
public partial class FRM_Patient_List : Form
{
SqlConnection con = new SqlConnection("Server= .; Database= GammaCamera; Integrated Security = true");
SqlCommand sCommand;
SqlDataAdapter sdAdapter;
DataTable dt;
string s;

public FRM_Patient_List()
{
InitializeComponent();
}

void FillGridView()
{
try
{
con.Open();
s = " select P_id as , P_Name , case when P_Gender = 1 then 'M' else 'F' end as 'الجنس', P_DateOfBirth , City.City_Name , ";
s = s + " Center.Center_Name , Phone1 , Phone2 , Doctor.Doctor_Name , ";
s = s + " SideName.Side_Name , P_Weight , P_Length , Notes ";
s = s + " from Patients ";
s = s + " inner join City on Patients.City_id = City.City_id ";
s = s + " inner join Center on Patients.Center_id = Center.Center_id ";
s = s + " inner join Doctor on Patients.Doctor_id = Doctor.Doctor_id ";
s = s + " inner join SideName on Patients.Side_id = SideName.Side_id ";
sCommand = new SqlCommand(s, con);
sdAdapter = new SqlDataAdapter();
sdAdapter.SelectCommand = sCommand;
dt = new DataTable();
sdAdapter.Fill(dt);
BindingSource BSource = new BindingSource();
BSource.DataSource = dt;
dGV_Patient.DataSource = BSource;
con.Close();
}
catch
{
return;
}
}

private void FRM_Patient_List_Load(object sender, EventArgs e)
{
FillGridView();
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900