You are viewing our Forum Archives. To view or take place in current topics click here.
C Sharp Google Yourself Application!
Posted:

C Sharp Google Yourself Application!Posted:

-Lewis
  • TTG Senior
Status: Offline
Joined: Feb 06, 201014Year Member
Posts: 1,297
Reputation Power: 56
Status: Offline
Joined: Feb 06, 201014Year Member
Posts: 1,297
Reputation Power: 56
Well, after my first day of studying C Sharp, I wanted to put my new skills to the test. This is a very basic program, made with very basic knowledge. However, it was fun to test myself!

I didn't really focus on the aesthetics, but moreso the functions and features behind the application.

Please don't be too harsh! This is only my first day!

Screenshot:
[ Register or Signin to view external links. ]

Virus Scan:
[ Register or Signin to view external links. ]

Download:
[ Register or Signin to view external links. ]


I'll show you the source code, so guru programmers can point out any bad habits!
Source 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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string firstName;
            string surname;
            string names;

            firstName = firstNameBox.Text.Trim();
            surname = surnameBox.Text.Trim();
            names = firstName + surname;

            if (firstNameBox.Text == String.Empty)
                MessageBox.Show("Please enter a value for 'First Name'", "Error");

            if (surnameBox.Text == String.Empty)
                MessageBox.Show("Please enter a value for 'Surname'", "Error");

            else
                webBrowser1.Navigate("http://www.google.com/search?btnG=1&pws=0&q="+ firstName + "+" + surname);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            firstNameBox.Clear();
            surnameBox.Clear();
        }


    }
}
#2. Posted:
Derp
  • TTG Senior
Status: Offline
Joined: Jan 24, 201014Year Member
Posts: 1,478
Reputation Power: 106
Status: Offline
Joined: Jan 24, 201014Year Member
Posts: 1,478
Reputation Power: 106
To see some C# programmers around here.

I only noticed one thing that could of been better, thats:


            string firstName;
            string surname;
            string names;

            firstName = firstNameBox.Text.Trim();
            surname = surnameBox.Text.Trim();
            names = firstName + surname;


could easily have been:

            string firstName = firstNameBox.Text.Trim();
            string surname = surnameBox.Text.Trim();
            string names = firstName + surname;


Other than that, nice.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.