I am new to coding in C#, we were given a simple exercise to write into text field and on press of a button, messagebox pops up with same text.
I have done some coding in java and I made a chat application with a chat window , where I have defined the task of appending into textarea into pressbutton event and called that function from textfield action performed event like this
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String msg=jTextField1.getText();
if(!msg.trim().equalsIgnoreCase("")){
jTextField1.setText("");
jTextArea1.append(username+" Says:\n"+msg+"\n\n");
JScrollBar sbver=jScrollPane1.getVerticalScrollBar();
sbver.setValue(sbver.getMaximum());
jTextField1.requestFocus();
try {
dos.writeUTF(msg);
dos.flush();
} catch (IOException ex) {
Logger.getLogger(ChatHandler.class.getName()).log(Level.SEVERE, null, ex);
}}
}
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
My question is whether there is any simple way to achieve this in C#, simple way as in without the manipulation of 'textfield.Text' returned string.

New Topic/Question
Reply




MultiQuote







|