We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I need to show the message on a Datagridview,I tried the follwoing code,but it doesn't work
static void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) { // handle message received string message = System.Text.Encoding.UTF8.GetString(e.Message); string guildstr = Guid.NewGuid().ToString(); string topicstr = "/lists/thenumber"; string clientstr = "client"; string usernostr = "userno"; int index = myform.MsgDGView.Rows.Add(); myform.MsgDGView.Rows[index].Cells[0].Value = "1"; // Exception occured myform.MsgDGView.Rows[index].Cells[1].Value = guildstr; myform.MsgDGView.Rows[index].Cells[2].Value = topicstr; myform.MsgDGView.Rows[index].Cells[3].Value = clientstr; myform.MsgDGView.Rows[index].Cells[4].Value = usernostr; myform.MsgDGView.Rows[index].Cells[5].Value = message; myform.MsgDGView.Rows[index].Cells[6].Value = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); for (int i = 0; i < myform.MsgDGView.RowCount; i++) { myform.MsgDGView.Rows[index].Cells[0].Value = (i + 1).ToString(); } myform.MsgTextBox.Text = message; }
The text was updated successfully, but these errors were encountered:
I don't know if it is related to the UI thread. Try this:
Invoke((Action)delegate { myform.MsgTextBox.Text = message; });
Sorry, something went wrong.
No branches or pull requests
I need to show the message on a Datagridview,I tried the follwoing code,but it doesn't work
The text was updated successfully, but these errors were encountered: