ChrisHunter 152 Posting Whiz in Training Featured Poster

Plan-B - Ill Manners

ChrisHunter 152 Posting Whiz in Training Featured Poster

When you renamed it did you click yes on the messagebox that asks if you want to change the the name everywhere it's references (if you've referenced form1 in other classes) ? i renamed the Designer file maulally i think . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

You don't need to a static class just pass the username to the username variable

Something like this:

This would go in your login:

    private void button1_Click(object sender, EventArgs e)
    {
        a = comboBox1.Text;
        Form main1 = new main();
        mail1.username = comboBox1.SelectedItem1.ToString;
        main1.Show();
    }

This would go in you main form to put the name in the textbox:

    public main()
    {
        InitializeComponent();
        textBox1.Text = username;
    }

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

It depends on what the database will be used to ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Yeah it's not too difficult to get the hang of in C# if you've done it in another language reading data is just the

This is to use the SQL DLL:

            using System.Data.SqlClient;

and this is the code to read the data:

            string sql = "SELECT * FROM MyTable";

            //creates new Sql command using sql statement and DB connection method
            SqlCommand cmd = new SqlCommand(sql, db.Connect());

            //creates DataReader to read selected data from database
            SqlDataReader reader;

            //stores result of SQL command and stores it within reader variable
            reader = cmd.ExecuteReader();

            //This section of code will loop while there is data to read 
            while (reader.Read())
            {
                //code to store read data goes here
            }

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

open your Program.cs file in your solution, and in the Application.Run(); type the word new followed by the name of the form you wantto be run first. so would be like:

            Application.Run(new LoginForm());

This specifies the form that you wish to run first.

Hope this helps.

Edit from above (not used to new site).

ChrisHunter 152 Posting Whiz in Training Featured Poster

open your Program.cs file in your solution, and in the Application.Run(); type new MyLoginForm so would be like:

            Application.Run(new LoginForm());

This specifies the form that you wish to run first.

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I've never done this myself but i would assume you need to create your own custom event handler and event. have a look at this

ChrisHunter 152 Posting Whiz in Training Featured Poster

This works i've tried and tested it, just put your directory in, call the method in the constructor or where ever you want and you will be good to go. (it shows the whole directors as well as the name, i don't know how to just return the name sorry).

private void locatetFiles()
        {
            listBox1.Items.Clear();

            try
            {
                foreach (string file in Directory.GetFiles(@"C:\Users\user_name\Pictures", "*.jpg", SearchOption.AllDirectories))
                {   
                    listBox1.Items.Add(file);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("" + e);
            }
        }

Let me know how you get on.

ChrisHunter 152 Posting Whiz in Training Featured Poster

try this, it worked for me but i was looking for all Xml file names and used a comboBox instead of a listBox (i've used your directory in the example).

private void locatetFiles()
        {
            ListBox1.Items.Clear();

            try
            {
                foreach (string file in Directory.GetFiles(@"C:\Users\James\Pictures\", "*.jpg", SearchOption.AllDirectories))
                {
                    ListBox1.Items.Add(file);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("" + e);
            }
        }

Hope this is better for you.

ChrisHunter 152 Posting Whiz in Training Featured Poster

i've only ever used a backend database to populate a list box but i don't know about the "Directory.GetFiles(@"C:\Users\James\Pictures\", "*.jpg").ToList();" part, but to put the names in the list box try this (the foreach section)

private void popListBox()
        {
            try
            {
                List<string> imgNames = Directory.GetFiles(@"C:\Users\James\Pictures\", "*.jpg").ToList();

                foreach (string str in imgNames )
                {
                    //Adds new item to listBox1 foreach item in sting list
                    listBox1.Items.Add(str);
                }
            }
            catch
            {
            }
        }

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

What is it you mean by browsing the grid values ? do you do any functions or are the any functions that are triggered by something your doing whilst browsing the grid ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

I've had a Dell XPS M1530 laptop for just over 3 years now and had to keep the AC adapter plugged in for just over two of those years, it started off as just loosing power quickly and not it won't turn on if i have the battery in as it tries to draw power from that but it's completely dead (and cost £109 to buy a new one from dell), and if you knock the power cable even a little bit the laptop dies straight away. It's happened with a lot of Dell laptops apparently but there's never been a re-call and I've read that replacing the motherboard and AC adapter may fix the problem but I've also read that in some cases that doesn't work.

I'm aware the creator of this thread may already have purchased a laptop but thought i would share this for anyone else looking into buying a new laptop. Also if anyone knows how to fix this problem please P.M. me.

Thanks

ChrisHunter 152 Posting Whiz in Training Featured Poster

Yeah i would assume the GUID works the same way an ID field works for a database records.

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you have a WHERE clause you can't use the selected value from your comboBox you need to specify what field in the database table you want to check e.g.

commandString = "Select * from tableadd where customerName like '%" + textBox1.Text + "%'" ;

This will return all records in tableadd WHERE curstomerName field is contains the value of textBox1.

What is it you're trying to use the selected value of the comboBox for ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

you could go for the age old library system or a system for a logistics company.

ChrisHunter 152 Posting Whiz in Training Featured Poster

My advice is to do a project and not a dissertation if possible. I.T. is a practical profession, if you want to be database admin a project (which is documentation, the app or DB) will be better than a dissertation as it shows that you can walk the walk and not just talk the talk. Dissertations are often for people who the lack the skill to do a project or lazy people as a dissertation at BSC level is only 10,000 words and projects are the documentation + the application/ DB (mine was 26,000 words + a C# app with SQL server back-end).

If you have the option i would suggest you do a project over a dissertation as you can also use that as part of your portfolio to show you have the practical skill as well as the underlying knowledge of the subject.

ChrisHunter 152 Posting Whiz in Training Featured Poster

You need to provide a lot more detail before anyone will be understand what you actually asking. What do you mean by only view the website ? why would you let a user do anything other than view your website ? what are you trying to stop the user from doing by only letting them view the website ? and are you asking for help with a user log-in function which is coded in C# (might be a stupid question but some people post in the wrong forums) ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Do NOT assume anything about a user. Users tend to know what you assumed about them and are going to do the exact opposite.

Do NOT assume anything about a user. Users tend to know what you assumed about them and are going to do the exact opposite.

Too true !

I'd go with the label option with it reading something along the lines of "please ensure all fields are completed before proceeding" of "please complete highlighted fields before proceeding", make it red, turn the opacity down so it isn't too harsh on the eyes and place it above all the radiobuttons and text fields.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have you tried:

string variableName;

And using this in-line:

'" + variableName + "'
ChrisHunter 152 Posting Whiz in Training Featured Poster

It's not a problem for me to be honest i get signed in automatically when i move to another page without re-entering my details.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I'm sure a quick Google will give you the answer but I'd say built-in functions are simply functions that are built into what ever it is your using. A C# example would be DateTime.Compare() which is a built-in function within the C# libraries.

ChrisHunter 152 Posting Whiz in Training Featured Poster

As kamilacbe said you need to use execute reader, your code should be something like this, try to understand it and change it to suit:

public List<string> getName()
        {
            //SQL statement to select Name from MyTable
            string sql = "SELECT Name FROM Mytable.Name";
	    
           //SQL command establishes database connection and executes SQL command
            SqlCommand cmd = new SqlCommand(sql, db.MyDBConnectMethod());

            //Creates list of strings
            List<string> NameList = new List<string>();

            try
            {
                //Creates SQLdatareader
                SqlDataReader rdr;

                //Reads the result of cmd 
                rdr = cmd.ExecuteReader();

                //Executes contents while there is data to available to read
                while (rdr.Read())
                {
                    //Adds each name read to a list of strings
                    NaameList.Add(rdr["Name"].ToString());
                }
                //Closes reader
                rdr.Close();
            }
            //Executed if try cannot
            catch
            {
            }
            //Returns string list
            return NameList;
}
ChrisHunter 152 Posting Whiz in Training Featured Poster

Judging by the fact that i have pretty much given the code to go into the method and haven't shown us your code yet i'm guessing you haven't attempted this yourself and you want us to give you the code rather than doing some research on the likes of the MSDN website and attempting it yourself.

Take what Ketsuekiame and I have said so far into account and give it a go yourself first.

ddanbe commented: Helpfull! +15
ChrisHunter 152 Posting Whiz in Training Featured Poster

Yes you if statement should look like:

if (txtName.Text.Length > 0)
{
 // this is where you should write the code that you want to execute if the text box has more than 1 charactor in it
}
else
{
// this is where you should write the code that you want to execute if the text box has 0 charactors in it
}

I'm sorry i can't understand anything after "how do i do the rest if its true". Can try to be a little clearer and post the code you have for this so far in code brackets please so i can get a better idea of what your asking.

Thanks

ChrisHunter 152 Posting Whiz in Training Featured Poster

Take a look at this link and give it a go. Bare in mind that you can get the length of the text box value by using:

myTextbox.Text.Length

(use this in your if statement).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Do some of your own research, try it yourself and the post a proper question with your own code rather than just "help me to get code as i m new to c#" isn't a question and "How can i get Combo-box values by typing in TextBox" isn't nearlly good enough.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Yeah, but generally a lower starting salary in a smaller business. Ie 22-24 rather than 24-26.

Thats a bit generous ! i did 2 days a week in a company for a year while i was at uni and now working for them and am on less than 20G a year. it's a smaller company too.

ChrisHunter 152 Posting Whiz in Training Featured Poster

have you tried converting it to a string when it is fetched from the DB and just treating it as a string until your putting it back in the DB or is that not possible in this case ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

I've got a Dell XPS M1530 and having a problem with the battery too. It was so bad that i had to have the charger in at all times but now it will only turn on if i leave the charger in but take the battery out so that it's running straight off the mains, the laptop wasn't even 2 years old when it started, either i had a dodgy battery or dell's batteries are rubbish !

Anyone know where i can get a new one (apart from dell they cost well over £100 which is extortionate and probably more than the laptop is worth now).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Ever listened to 4 guys and a girl playing together on ONE guitar?
Here is jour chance: http://www.youtube.com/watch?v=d9NF2edxy-M

YES ! and it's awesome ! the guy with the beard on the end is a legend !

One direction - one thing *palms face*, i have BBC Radio1 on honest

ChrisHunter 152 Posting Whiz in Training Featured Poster

There are a few threads that are about exporting to Xml using c#, take a look at those and try and apply them to suite your needs (its the same principle, put the data from the datagGrid into variables and export them in a structured tree format). if you run into problems just post the code and issues back here.

ChrisHunter 152 Posting Whiz in Training Featured Poster

the pizza war

Nope the answer is the last war he fought in.

Where can I get a time machine?

a watch shop.

Why is the sun so hot ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Speed - wireless has to be converted into a transmittable state before its sent and can be easily interrupted/ weakened/ stopped all together by buildings, a drop in wireless connect etc. Where as wired connection is predominantly faster than wireless connections as the data has physical means of being sent which has a reduced change of a drop in connection due to the physical connection but can wires can be physically tampered with or be affected by static interference and isn't convenient over a wide area (WAN)

ChrisHunter 152 Posting Whiz in Training Featured Poster

I used to be known as Wavey Davey

Wow i just did a Google search on Wavey Davey (i do remember the name) and didn't quite get what i was expecting . . . the I.T. department won't be happy with that. There was one picture of a guy with keyboard.

You'll have to let me know if it gets the go-ahead so i can watch it.

ChrisHunter 152 Posting Whiz in Training Featured Poster

was this supposed to be such a boring game ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Create a separate .cs file for each of the form (not the one when you right click on a form control and click view source) and call them something like Frm1Functions and Frm1Functions, then from Frm1Functions call form2 and from Frm2Functions call form2. this means that the actual form are constructed when the form is instantiated (done in the rightclick view source cs file and not the ones you've created) this means that the forms wont be in a constant loop anymore.

Hope this makes sense and is helpful . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

I use Chrome and have that problem but i don't need to log in i can just click on any link that is linked to a daniweb page and it logs me in automatically. Bit annoying but like you should always do with word documents, save your work, just copy it all before you click submit an if you do get logged out you wont loose everything

ChrisHunter 152 Posting Whiz in Training Featured Poster

Refraction of light through particles in the earths atmosphere, that's not really a stupid question that gets a stupid answer.

What was the last war Napoleon Bonaparte fought before his death in 1821 ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

how do you mean print it ? output it to a console window ?

If you'r asking something like this you clearly haven't searched it in Google.

string string3 = string1 + string2;

Console.WriteLine("" + string3);

OR

Console.WriteLine("" + string1 + string2);

ChrisHunter 152 Posting Whiz in Training Featured Poster

i think it might be because it's in an infinite loop. form1 is accessing form2 while form2 is trying to access form2 so they are just in an infinite loop.

i think you can make a middle-man type class that references both forms to do the functionality (it's always best to have a class that does most the functionality rather than doing it in the forms cs file, especially in bigger projects).

also what are you using the form2_Load() for ? the form2() is the constructor method and will execute anything in it when form 2 is loaded.

ChrisHunter 152 Posting Whiz in Training Featured Poster

The example you've given is fine and won't cause any problems because you've used return which will jump out of the method from that return keyword.

If you didn't have the return or break key word and just had some code like set a bool variable to true then it would continue executing the code after the if statement once the if statement is complete.

hope this helps . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

including a stint presenting a couple of TV series here in the UK.

Which TV shows have you presented ?

Sorry if that comes across wrong it is a genuine question, i live in the north west near Liverpool (I'm not a scouser) so i might have seen you on the TV before without realising.

happygeek commented: :) +0
ChrisHunter 152 Posting Whiz in Training Featured Poster

No, some places do graduate schemes, take people (who aren't masters) on for less pay but pay for training so your home grown. Also if your at university/ collage you can get sponsored by a company and do work experience in a company in the hope that you will be hired afterwards if you impress them.

Obviously you need some sort of experience in programming.

WaltP commented: In the UK, don't they teach you the difference between YOUR and YOU'RE??? It makes understanding difficult. -4
ChrisHunter 152 Posting Whiz in Training Featured Poster

is the a value/ selected value changed method for the controls you're using ? i used a property grid control to display retrieved data and used SelectedGridItemChanged() to detect a change in the displayed item, then i just set the text of a label when a change occured, i assume you can do this with the title of a form ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you've got ears as saggy as a 90 year old bits and you go for the same job as someone who is clean cut, equally as qualified and experienced you're more than likely not going to get the job. If that wasn't the case i would have rocked up to my interview in shorts and flipflops instead of getting suited and booted and having a shave (i usually have stubble) After all if you work for a company you represent that company and i'm sure companies would prefer a smart squeaky clean image that's why CEO's are generally clean cut, well dressed and don't usually have visible tattoo's.

On the other hand try your best to look dapper for interviews and follow company dress codes (i.e. shirt and tie if it's required). If they ask you to take all your piercings out and you really don't want to keep searching you'll eventually find somewhere

How ever i love and can't wait to get a few tattoo's i just need to grow a pair first.

ChrisHunter 152 Posting Whiz in Training Featured Poster

so have you just found this on the internet and going to submit it as your project for collage ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Straight up just enable mobile/ wireless connections, if your using a smart phone (iPhone, android, window, etc) that should just do the trick . . .

ChrisHunter 152 Posting Whiz in Training Featured Poster

Haha I always seem to have screw left over at the end of fixing something. thanks for you opinion rameneater90.

ChrisHunter 152 Posting Whiz in Training Featured Poster

in that case C# and possibly Java. i made a basic website in HTML a few years ago but probably couldn't do it now.