Hi guys, Ive been doing c++ for a while now and feel very comfortable with the language. But it seems like the job market is all moving to c# and I feel I need to get started on learning c#. Could you guys supply some links? Ive been doing so google searching, but havent really found anything that is for a c++ programmer moving to c#. Thanks.

Hi well its going to be a hard journey as you have gone from the normal native language of high level programming C++ to the more Microsoft Controlled program. if you programmed C++ you using Visual Studio, you shouldn't have as much of a problem whereas if you used delphi you could have more of a problem. i will post some examples for you of good things to learn and practice

Your General Hello World

this.label1.Text = "Hello World";
this.textbox1.Text = "Hello World";

Showing the date and the time on a form.

this.button1.Text = DateTime.Today.ToLongDateString();

the time

this.label1.Text = DateTime.Now.ToShortTimeString();//you can also change it to .ToLongTimeString();

How about drawing some graphics?

protected override void OnPaint(PaintEventArgs pea)
        private void paint()
            Font f = new Font(new FontFamily("Times New Roman"), 10);
            Pen p;
            SolidBrush b, bT = new SolidBrush(Color.Black);
            Graphics g = Graphics.FromHwnd(this.Handle);
            Color cP = Color.Gray;
            Color cB = Color.LightGray;
            p = new Pen(cP, 6);
            b = new SolidBrush(cB);
            g.FillRectangle(b, 4, 4, 260, 220);  
            g.DrawRectangle(p, 4, 4, 260, 220);
            g.DrawString("C# is fun!", f, bT, 180, 190);
            g.DrawString("C# is fun!", f, bT, 3, 13);

Now we should move on to error messages using the try method
there are 3 parts of the try method
first try is to be used when something is not guaranteed to work
then catch is if what you wanted to try didnt work.
then theres finally, it means if all of the above fail this one SHOULD NOT BE WRITTEN when their is a chance of the finally not working it should nearly always be like this,

using System.IO;
} catch {
MessageBox.Show("File not able to create retrying in a different location.");
finally {
MessageBox.Show("Could not Create any file Application terminated.")

Now the if statement

if (File.Exists("C:\\Users\\Familly\\J.txt"))
             MessageBox.Show("File exists Running stupid junk :P");
            else {
                MessageBox.Show("File unavailable... Attempting to create. running external program.");
                File.Create("C:\\Users\\Familly\\J.txt");// using System.IO;
                Process.Start("calc.exe");// using System.Diagnostics;


Well one way i learned c# is by making log on things where you needed to enter a password aswell as Web Browsers.
Lets go on with the logon suite

its fairly easily coded with a windows form but once you get more adapt in C# you can start paring it with XML so that user may select their own password whereas from it being hardcoded in.

Logon suite ( NO XML )

if(this.Textbox1.Text == "Password")
Form2 f2 = new Form2();
this.hide(); // this reffers to the for you are working on.
MessageBox.Show(" Incorrect try again. ");

See how easy that was? well when you get better you can use system.io to create a text file everytime they get it wrong and on load up of the form you can check if the file exists and if it does well then you can tell the user they have had to many wrong attemps and must start again.

Basic Webbrowser

Well this is what i find fun to do, i have designed my own c# webbrowser and coded it using XML to record favourites and history. but here we will just start basic for you.
We will do: go;Home;Back;Forward;Refresh; and search if you want to learn more about webbrowser and tabs and history/xml PM me and i will start a new thread so everyone can benefit from it.

WebBrowser Code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _1
    public partial class Form1 : Form
        public Form1()

        private void Form1_Load(object sender, EventArgs e)
            timer1.Enabled = true; // timer enbaled

        private void timer1_Tick(object sender, EventArgs e)
            this.toolStripStatusLabel1.Text = this.webBrowser1.StatusText; 
            this.toolStripStatusLabel2.Text = DateTime.Now.ToShortTimeString(); // time is always handy

        private void back_Click(object sender, EventArgs e)
            this.webBrowser1.GoBack();// back

        private void forward_Click(object sender, EventArgs e)
            this.webBrowser1.GoForward(); // forward

        private void home_Click(object sender, EventArgs e)
            this.webBrowser1.GoHome();// home

        private void Refresh_Click(object sender, EventArgs e)
            this.webBrowser1.Refresh();// refresh

        private void Go_Click(object sender, EventArgs e)
            this.webBrowser1.Navigate(this.toolStripTextBox1.Text); // go

        private void search_Click(object sender, EventArgs e)
            this.webBrowser1.GoSearch(); // navigates to the users default search engine

        private void Cancel_Click(object sender, EventArgs e)
            this.webBrowser1.Stop(); // stops the current action

        private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
            if (e.KeyCode == Keys.Enter)


I think thats enough for you to chew on for now if theres anything you need or a question you need to ask post it on this thread and i will reply to you soon

Hope this helps


commented: Nice effort. +7