Wednesday, April 18, 2012

සරල program එකක්


අද අපි බලමු කොහොමද සරල program එකක් කරන්නේ කොහොමද කියලා මුලින්ම ඔයාලට ගෙනාවේ introduction part එකනෙ.
මෙන්න මේ විදියටයි program එක run කරාම display වෙන්න ඕනෙ.
මුලින්ම ඉහලින් තියෙන ආකාරයට form  එක design කරගන්න.
Welcome button එකට මේ ආකාරයට coding කරන්න.
 private void welcmebtn_Click(object sender, EventArgs e)
        {
resultTextBox.Text = "Welcome:" + FstNmeTxtBox.Text + " "
+ lastNmeTxtBox.Text;
        }

Clear button එකට coding
private void clearBtn_Click(object sender, EventArgs e)
        {
            FstNmeTxtBox.Text = "";
            lastNmeTxtBox.Text = "";
            resultTextBox.Text = "";

            //මුල්ම textbox එකට cursor එක focus කිරීමට

            FstNmeTxtBox.Focus();
        }

Exit button එකට coding
private void ExitBtn_Click(object sender, EventArgs e)
        {
           
            this.Close();
        }

මෙම program එකට අපි භාවිතා කලේ “+” mark එක මේ mark එකට කියන්නේ concardination operator   කියලා ඉස්සරහට ගොඩක් භාවිතා කරන්න වෙන නිසා ඔයාලත් කරලා බලන්න