it has been almost a week since my last tutorial ,my fingers were all crammed up writing those length tutorial and testing the code for bugs ,Practicability ..what not !Instead thought of writing short burst of useful code that every programmer would like to know.something like ...
how do i change the button text through program? can i move the form behind another? .The post will be updated each day ,hence the members could benefit from one single post rather than searching loads of data.
Tip of the day : April 6th 2010
Q ) How do i get the selected item from the comboBox control ?
ans : This is the foremost functionality any windows or Asp.net application programmer would like to know. As always there are more than 1 ways to do things when it comes to programming ,& this is one of them.
ComboBox1.[COLOR=DeepSkyBlue]SelectedItem[/COLOR]try putting that to a live example with a messagebox and see for yourself
comboBox1.[COLOR=MediumTurquoise]SelectedItem.ToString()[/COLOR]yes the code is bit different because C# is strongly typed language and programmer has to explicitly specify that the selectedItem is a string.
Tip of the day : April 8th 2010
you might be wondering why 7th is not in the list , the post got approved late that was the reason ! any way let us learn something today
Q)How do set the Text in the textbox on a Button click?
ans: This is like such a common functionality someone would like to provide.Used in many,many applications like a sales calculator where the cashier clicks the button to get the total in a textbox , a simple calculator perhaps needs this functionality too .so lets see how to set the text programmatic ally.
First drag and drop a textbox , button onto a windows form in windows forms application.Donot change any properties .
Double click the button on the form .You will be shown the code window with a event handler for the button1_click write this code inside the event handler
[COLOR=MediumTurquoise]this.TextBox1.Text[/COLOR] = "Hello World !" ;
[COLOR=MediumTurquoise]Me.TextBox1.Text[/COLOR] = "Hello World !"
Now run the form by hitting the F5 key . Click the button.
The text of the textbox is changed to "Hello World!" now.that is it for today guys
Edited by gokuajmes, 08 April 2010 - 06:43 AM.