To masters out there, I'm having problem with passing values 2 user controls within a form. I have usercontrol A which has combobox and a button and control B that has a datagridview. Now I want to display the data in User Control B which is in the datagridview. How can I pass the data from UCA to UCB? Here's the data I want to pass:
So in User Control A when I clicked the button named Generate, it will fill the datagridview in User Control B with the data generated in the GetConvo() below.
public DataTable GetConvo() {
DataTable table = new DataTable();
table.Columns.Add("ConvoUser", typeof(Object));
table.Columns.Add("Message", typeof(Object));
table.Columns.Add("Date", typeof(Object));
var _data = from data in User.GetMatchConvo(comboBox3.SelectedValue.ToString())
select new {
convoUser = data.actor_id,
convoMessage = data.message,
convoDate = data.creation_timestamp
};
foreach (var data in _data) {
table.Rows.Add(data.convoUser, data.convoMessage, data.convoDate);
}
//dataGridView1.AllowUserToAddRows = false;
//dataGridView1.AllowUserToDeleteRows = false;
return table;
}
private UserInterface User = new UserData();