954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C# Code

hi guys, I am a Beginer Programmer. :confused:
I Like to Learn about C# and i started from a week ago.
I Searched in google to find a froum to get some help about C#.
and i found this website.i hope i can find some friend to get help.
For first Question, i want to make a project and i have some question about it.
i have a Main page ( Form1 ) and i have a ComboBox on it.
i made a ComboBox with Readonly( true) and i put a RichTextBox under this ComboBox on mainpage.
now, in ComboBox i have 2 selecteditem.
i want to know how to write code for combobox that if someone klicked on first selecteditem in combobox then he will see in richtextbox for example ( hello ) , if he klicked on second he will see in richtextbox ( bye )?
Can someone please help me?
Thank you so much :p

ShahdaaD
Newbie Poster
2 posts since Dec 2006
Reputation Points: 10
Solved Threads: 0
 
hi guys, I am a Beginer Programmer. :confused: I Like to Learn about C# and i started from a week ago. I Searched in google to find a froum to get some help about C#. and i found this website.i hope i can find some friend to get help. For first Question, i want to make a project and i have some question about it. i have a Main page ( Form1 ) and i have a ComboBox on it. i made a ComboBox with Readonly( true) and i put a RichTextBox under this ComboBox on mainpage. now, in ComboBox i have 2 selecteditem. i want to know how to write code for combobox that if someone klicked on first selecteditem in combobox then he will see in richtextbox for example ( hello ) , if he klicked on second he will see in richtextbox ( bye )? Can someone please help me? Thank you so much :p

We are more than willing to help, but we don't do the work for you. The idea is that you take the effort to learn for yourself, and when you get stuck or don't understand why something is not working or working for that matter, you can post the details here.

I would start with either a textbook or my personal choice is to go to the web and do a little research.

here is an ok link to a C# tutorial and slide show : http://www.devhood.com/training_modules/dist-a/LearningCSharp/?module_id=2

One question is what version are you looking to learn? The latest and greatest version (3.0 framework) or C# on the 1.1 or 2.0 framework. I would personally recommend 2.0, but that is just a personal choice at this time.

Also, are you wanting to learn it for the web (i.e. ASP.NET with C#) or for Windows API (C# programming) ??


Here is a link to some other things that may help you get started:

Learning ASP.NET : http://www.asp.net/getstarted/default.aspx?tabid=61

C# General
http://www.c-sharpcorner.com/

Also I would spend some time reading the forums here as you may pick up a thing or two that will lead you to your answers.

Good luck.:cool:

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
 

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textBox1.Text = "";
if (comboBox1.SelectedIndex.Equals(0) )

textBox1.Text = "hello";
if (comboBox1.SelectedIndex.Equals(1))
textBox1.Text = "bye";

}

fanofeducation
Newbie Poster
1 post since Dec 2006
Reputation Points: 10
Solved Threads: 0
 

It can be achieved as:

if (cmbo.selectedindex==0) /////it will return first selected item...
rtb.text="Hello";
if (cmbo.selecteditem==1)////it willl return second
rtb.text="bye";


i think it will work.try it :regards

Aun Muhammad
Newbie Poster
8 posts since Jan 2007
Reputation Points: 10
Solved Threads: 1
 

Hi there,

I would say read through as many books and sites as possible. This is one that I found very good when I was first starting out:
http://www.samspublishing.com/library/content.asp?b=STY_Csharp_24hours&seqNum=10&rl=1

RwCC
Junior Poster
177 posts since Jan 2006
Reputation Points: 70
Solved Threads: 4
 
hi guys, I am a Beginer Programmer. :confused: I Like to Learn about C# and i started from a week ago. I Searched in google to find a froum to get some help about C#. and i found this website.i hope i can find some friend to get help. For first Question, i want to make a project and i have some question about it. i have a Main page ( Form1 ) and i have a ComboBox on it. i made a ComboBox with Readonly( true) and i put a RichTextBox under this ComboBox on mainpage. now, in ComboBox i have 2 selecteditem. i want to know how to write code for combobox that if someone klicked on first selecteditem in combobox then he will see in richtextbox for example ( hello ) , if he klicked on second he will see in richtextbox ( bye )? Can someone please help me? Thank you so much :p

hope this will help u

richtextbox=combobox.selectedItem

archa
Newbie Poster
2 posts since May 2010
Reputation Points: 9
Solved Threads: 0
 

[QUOTE=archa;1214190]hope this will help u

richtextbox.text=combobox.selectedItem

archa
Newbie Poster
2 posts since May 2010
Reputation Points: 9
Solved Threads: 0
 

Please read the rules before posting again - http://www.daniweb.com/forums/thread78223.html and rules .

Please do not resurrect old threads.

If you have any questions please ask. .... You are welcome to start your own threads.

Thread Closed.

__avd
Posting Genius (adatapost)
Moderator
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You