ChrisHunter 152 Posting Whiz in Training Featured Poster

Why don't you create a stored procedure to search for a record based on an ID passed in from the data grid view, instead of doing the query in your VB code?

It means all your stored procedures are in one place and have can be easily identified and modified.

It saves having to search through your VB code to find the string, can save you bulking your VB code out with query strings and is more managable in the long run. Especially when it comes to bigger application.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Ford Focus Zetec 1.6 for the last 4 years which I'm selling because I don't use it much anymore :(

I now ride a Suzuki SV650 SK8 in blue which is why I don't use my car anymore. Always wanted a bike, even over a car, I can't get enough of it.

GSZR700 or BMW HP4 RR next! or a van to convert like @HappyGeek is doing.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Replace saveFileDialog1.Close(); with Application.Exit();

saveFileDialog1.Close(); terminates the application

ChrisHunter 152 Posting Whiz in Training Featured Poster

Try this:

UPDATE table1 t1 
    SET table2.b = t1.b
    WHERE t1.a = table2.a 

Let me know if this works or not.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It's a question typed straight from a homework sheet by the sounds of it but what I think @Santanu Das is asking is if an item is marked at £100 and the seller sells it for a 10% loss on the the on the marked price, what is that price and how is it worked out.

@Santanu Das, to work out a persentage of something you take the number that number, devide it by 100 and then multiple it by the persentage you wish to find.

For example 10% of £100 is worked out as:
£100 / 100 = 1
1 x 10 = 10 <---- Stick a % on that and that 10% loss of a £100 item.

This can easily be googled so please show that you have at least tried solve or google it yourself before you post a question.

We're always happy to help but the rules do state that you should you have at least attempted to solve the problem yourself first.

Happy coding!

ChrisHunter 152 Posting Whiz in Training Featured Poster

HA! That's for me to know and you to find out ;)

You're homework, your problem... Unless you've shown that you've made a conscious effort and not just looking for someone to do your homework

ChrisHunter 152 Posting Whiz in Training Featured Poster

Price / 100 x 10 (persentage)

I WIN !

ChrisHunter 152 Posting Whiz in Training Featured Poster

@cgeier is right, the exception will just be passed back through the call stack until it hits the catch in MethodA.

Also as @cgeier said, if MethodB and MethodC don't do anything other than return the value returned from the method they have called they are redundent (I assumed you would be doing other functions dependent of the returned values).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Is this the kind of thing you're looking for?

        public static void MethA()
        {
            try
            {
                MethB();
                Console.WriteLine("String is NOT empty");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
        }

        private static bool MethB()
        {
            return MethC();
        }

        private static bool MethC()
        {
            return MethD();
        }

        private static bool MethD()
        {
            string userInput = Console.ReadLine();

            if (!string.IsNullOrEmpty(userInput))
            {
                return true;
            }
            else
            {
                throw new Exception("String is empty");
            }
        }

If you throw the exception in MethodD it either throws an exception, bombs out of the application and displays the exception or the exception is caught by the first try/ catch it comes to and is delt with accordingly.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I don't know to be honest. If its an app where the user needs to enter text I'd show a messagebox if the string was empty.

try putting the try catch in MethodA and throwing the exception in MethodD. It should just fall through to MethodA.

strRusty_gal commented: Thanks for the reply +3
ChrisHunter 152 Posting Whiz in Training Featured Poster

Can you not just return an empty string?

You could always throw an exception. It's not recommended but it's an option.

ChrisHunter 152 Posting Whiz in Training Featured Poster

My brother had an S4 and he had a problem with the battery swelling up and not charging properly/ loosing charge quickly.

Turned out to be a know fault and they replaced it so do a few searches to see if it's a known fault. Hopefully they might replace the battery for you.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Music on a BSC IT course? I've never heard of that.

It depends on the place you study and the type of person you are. My University wasn't the greatest because they invested heavily in the sports department and not IT but it was still worth while.

My advice is to make sure you take the time to understand what you're being tought, you'll be a more confident programmer at the end of it all. There will always be people in your class who don't listen and rely on others to do their work that but quite often they don't graduate.

Also don't forget to ask questions if you don't understand something, your tutors will always be willing to help. There will always be someone here at DaniWeb that will be willing to help you too, as long as you're willing to try, myself included.

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

I have one of those... I'm a software engineer for an insurance brokers. What type of job do you want? did you specialise in anything during your degree?

I specialised in software development so that's the path I followed professionaly.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Try deleting the record from MovieCopy table, before deleting from the Movie table, so that the reference to the Movie table record doesn't exist.

Also you might need to move dataGridView1.Rows.RemoveAt(selectedindex); and put it below cmd4 = new SqlCommand.

By the looks of it you're deleting the record at "Selectedindex" which removes that row and the row at "Selectedindex" is now the row below meaning MovieID won't be the ID of the row that has just been removed from the datagridview.

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Move dataGridView1.Rows.RemoveAt(selectedindex); and put it below cmd4 = new SqlCommand.

By the looks of it you're trying to get the MovieID from a row that doesn't exist at anymore.

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

@Wael1988 by the looks of what you have studied you've know quite a few languages. I only know C#, Sql and a bit of VBA. I've worked with reporting services too but that's about it.

Experience with SharePoint is/was quite sort after when I was looking for a job 2 years ago but it's best to focus on two or three specific languages, such as C# and SQL, and use those as you're main selling points. This way you have the front end language with the C# and back end language with the SQL.

As you have suggested yourself the best way forward is to get as much development under your belt as possible. I'm in the same position as you I always forget what I've been studying.

Keep going, it's not easy but the more you do the easier it will get!

Good luck.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Cold chocolate fudge cake with vanilla ice cream every time.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hate the stuff! It makes everywhere look scruffy as hell, it gets every where and there's too many people who sound like a camel when they're eating it!

I got it stuck to my shoe twice last week.

I don't want to hear people chomping, it don't want to see what people are eating and I 100% don't want have to scrape it off what ever clothing it gets on, just brush your teeth or eat smint!

Screw it I'm moving to Singapour!

ChrisHunter 152 Posting Whiz in Training Featured Poster

Naaahhhhhh scooters and bikes are safe if everyone pays propper attention.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I used to ride a scooter when I was 16. My first was a Piaggio NRG 50cc but a lady pulled out on me, I hit the side of her car at nearly 30mph, flipped over the car, rolled an slid down the road. I did both of my knees and the scooter was a write-off.

Second scooter was a Peugeot Vivacity, a fella pull out on a roundabout on me and I hit the side of his car but I had managed to slow down enough to only leave a dent in his door. I also dropped it going around a corner in the rain because the car in front of me slammed on (pressing the breakes on a corner is never a good idea, never mind in the wet), but I only lay the bike down and carried on running across the road.

You need to be more careful, you're not in a big metal cage. By the sounds of it you already know how it feels to bin it.

Got my full bike lisence now though so can't wait to get bike and get out!

ChrisHunter 152 Posting Whiz in Training Featured Poster

In all honesty I hardly do anything. I'm one of those people who rarely feels hungry but can out eat the majority of people and not put any weight, or go a day or so so without realising I haven't eaten.

I haven't got a six-pack and I'm not ripped but I climb a lot and do the odd week of exercise (to try to get ripped) when I'm bored so I don't look like a muffin but don't ask me to run a mile because I probably won't make it half way!.

Like my Bio says I'm distinctly average...

ChrisHunter 152 Posting Whiz in Training Featured Poster

That would mean the more and more jobs there are the more tables you will need. You can limit the size of your DB by just having a Employee table (for the people), a JobTypes table (for the different jobs) and a table named something like EmployeeJobs which references both the Employee table and the JobTypes table.

This way you just add a new record into the JobTypes table for each job (e.g. manager, director etc). Other wise if you keep adding a new table for each your database will become more and more unmanagable.

As for denormalised databases they have their perks and if you're an experienced DBA it's probably as easy to use as a normalised one.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It depends on the layout of you database itself.

If you have a the following tables it's not possible (or isn't ideal):

Person_tbl
* PersonID (PK)
* Name
* JobID (FK)

Job_tbl
* JobID (PK)
* JobTitle

However if you have a the following tables it is probably the best way to go about it:

Person_tbl
* PersonID (PK)
* Name

Job_tbl
* JobID (PK)
* JobTitle

PersonRoles_tbl
* RoleIF (PK)
* PersonID (FK)
* JobID (FK)

This way you can assign multiple people to multiple jobs.

Hope this helps, let me know if you need any clarification.

ChrisHunter 152 Posting Whiz in Training Featured Poster

According to MSDN which is the first search result when you Google "System.Uri", it "Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI."

ChrisHunter 152 Posting Whiz in Training Featured Poster

Good to hear you have found the solution and sorry I was much help to you.

Don't forget to mark the thread as solved and don't hesitate to ask if you have any other questions.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I know exactly what you mean London-G, some stuff does stick but I do have to keep looking over previous code for help.

Practise makes perfect I guess...

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi ss125 are you still looking for a solution to this problem?

If so can you tell me what type of DB you're using as I only know how to use MS SQL server 2005 onwards.

Can you also show me what code you have done so far please? (I can't just give you the code but I can help you where ever possible).

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you want to allow the user to select more than 1 entry I would suggest using a list box control and changing the selection mode property rather than using a combo box because combo boxes should really only be used to select a single value.

You don't actually ask a question you've just stated that you need to update a table but I'm guessing you want to know how to update a table where the value of a record is the same as the name selected?

Do you want to update multiple values at a time?

ChrisHunter 152 Posting Whiz in Training Featured Poster

It's a case of the company either needs to have enough funds to pay for a good website or know a dev that can do it for them at mates rates, other wise it's usually an off the shelf template or D.I.Y job.

That doesn't necessarily mean it's a bad company, they might be a top class plasterer who just wouldn't be able justify paying for a top website. The affect a website has on a company depends the company it's for really.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Try just setting it in the properties window in design mode.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Been there, done that and wear my "I don't regret my decision" T-shirt with pride!

ChrisHunter 152 Posting Whiz in Training Featured Poster

@Ketsuekiame it could just mean you took the chances and liked the result. Why would you regret a choice you've made if you liked the outcome.

ChrisHunter 152 Posting Whiz in Training Featured Poster

@diafol Yeah I usually go climbing and camping in Snowdonia, Llyn Gwynant for camping and then into the llanberis pass for a bit of boulding or a walk up snowdon. Never been to the south yet though.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Happy St Davids Day, I love Wales. I can't wait for the weather to pick up enough for camping and a bit of climbing.

Hope you've had a good'n diafol

ChrisHunter 152 Posting Whiz in Training Featured Poster

Good job you didn't try to climb back down or it could have ended a lot worse than it did.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Climbing up the side of a building unaided whilst drunk.

What happened?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Did you loose him?

Mine is propbably not going on a 3 week road trip around America with a couple of friends, even though my parents offered to loan me the money.

They're pretty good like that my parents, they'ed rather me borrow the money and experience something like that (because they know I work hard to pay it back as quick as possible), than not do it an regretting it later in life.

Moral of the story... Better to live in regret of the things you have done, than those you have not - Lucille Ball (almost).

ChrisHunter 152 Posting Whiz in Training Featured Poster

I use CodeMaid to organise my code and StyleCop to add the necessary formatting like blank lines, comments and the rest.

Edit: I code in C# atm.

ChrisHunter 152 Posting Whiz in Training Featured Poster

My hard drive died ages ago and I havent put my music back on the new one, I just listen to music on 8tracks or YouTube.

Jack Johnson, Ben Howard, King Charles, Mumford and Sons, Eletric Swing and a bit of Funky House, old school HipHop or something with horrible bass are all I listen to right now and it's all streamable on the net!.

ChrisHunter 152 Posting Whiz in Training Featured Poster

So where is it giving you the error and what does the error say?

I'm an Sql Serever developer so my knowlage of Access is limited I'm affraid but I'll still try to help if I can.

ChrisHunter 152 Posting Whiz in Training Featured Poster

try Convet.ToInt64(dataGridView2.SelectedCells[0].Value) and see what happens.

Let me know how you get on.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Is cashID an int value?

If cashID is an int do cashID = " + (int)dataGridView2.SelectedCells[0].Value + "";

In the long run the best thing to do is to creats a stored procedures on the database side, it will help prevent the SQL statements from being changed while you're editing you app.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Not a problem, glad I could help.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Same as the SELECT statement, the WHERE clause should be done on the unique identifier column (primary key/ ID column)

You should know the ID of the record as it should be returned as part of the SELECT statement something like: WHERE ID = myID.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Oh sorry, it looks like you've got your INSERT statements and UPDATE mixed together, for an INSERT you do something like:

INSERT INTO myTable (Name, Adddress, DOB) VALUES ('" + nameTextBox1.Text + "', '" + addressTextBox.Text + "', '" + dateOfBirthTextBox.Text + "')

But for an UPDATE you do something like:

UPDATE myTable Set Name = '" + nameTextBox1.Text + "', Address = '" + addressTextBox.Text + "', DOB = '" + dateOfBirthTextBox.Text + "'";

You need a where clause too if you want to update a specific record and not all of them.

Hope this helps.

ChrisHunter 152 Posting Whiz in Training Featured Poster

put the word set after the table name see if that works.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Have you set the HeaderCell property for the DGV to true?

dataGridView1.Columns["CashAccRef"].HeaderCell.Visible = true;

ChrisHunter 152 Posting Whiz in Training Featured Poster

You shouldn't use Wikipedia to back up and argument or in research, it can be edited by anyone so it's unreliable.

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you're gaming online I'd suggest you get as usage limit as possible, it might be easy to reach your limit, especially if there are a few people using the same connection.