ChrisHunter 152 Posting Whiz in Training Featured Poster

"If you're not falling off climbs then you're not pushing yourself" - Tom Williams (Climber/ staff member at my local climbing wall).

ChrisHunter 152 Posting Whiz in Training Featured Poster

Your english is good. just show some evidence of having made an attemp at the problem, alot of the time you can find the answer on google. We were all new here once so my apologies for sounding rude earlier, i have replyed to your z-algorithm thread but it's in c#, it should translate across to Java easily. Also could you explain the above issue in a little more depth please, what is the progressive center-star method ? what exactly is it that your are trying to do ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Shsh111 stop asking for people to do the work for you and show us what you have done so far so we can help you. If you get people to do your homework for you your going to struggle when the time comes to do the work yourself which means you're going to have wasted a lot of your own time.

Also reply to your threads once someone has replyed to your question or at least mark it solved, that way we know you've either solved the problem or need more help.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Try unpluging your laptop charger from the wall (but leave it in your laptop) and hold the on button on your laptopn untill the light on the charger goes off. this should drian all power from your battery and the charger, once the light on the charger has gone off plug it back in again, wait for 60 at least seconds and try turning your laptopn on.

If the above doesn't work try taking the charger out of your laptop, taking battery out of the laptop, plug the charger (but not the battery) back in to the laptop and turning it on.

They are the things i tried with with my Dell when i had a similar propblem.

ChrisHunter 152 Posting Whiz in Training Featured Poster

You could put each charactor of the string into separate inidex's of an array. Then you could loop through the array, storing the current and the previous array index value in separate variables to compare.

It's hard to explain and probably not the best way to do it but this is how i would do it in C# you should be able to do the same in Java quite easily (i'm not too good at Java):

        static void Main(string[] args)
        {
            // Asks for input from user
            Console.WriteLine("Please enter a sting");
            // Reads, stores and duplicates input
            char[] copy1 = Console.ReadLine().ToCharArray();
            char[] copy2 = copy1;

            // Loops through for each array index (each charactor of the input
            for (int i = 0; i < copy1.Length; i++)
            {
                // Check that arrayin length is not exceeded if 1 is added to the value of i when access array index of copy 2
                if ((i + 1) < copy1.Length)
                {
                    // The increment is done at index
                    if (copy1[i] == copy2[i + 1])
                    {
                        Console.WriteLine("The two charactors were the same");
                        Console.ReadLine();
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("There were not charactor duplicates in the string entered");
                    Console.ReadLine();
                    break;
                }
            }
        }

Hope this helps, let me know if you have any problems with it.

ChrisHunter 152 Posting Whiz in Training Featured Poster

What have you go so far? or are you looking for a place to start the program?

ChrisHunter 152 Posting Whiz in Training Featured Poster

People may see this as Big Brother gone wild again but if you've done nothing wrong and have nothing to hide then you shouldn't have a problem. If you've ever been unfortunate enough to have been robbed or been the victem of a crime then you should be more than happy to help catch those responsible, whether it be by helping identify the criminal or just identifying a witness. However I could understand if a lot of people wouldn't use the app because they may know family members or friends that may be commiting crimes and may not want to be responsible for turning them in.

I've been robbed before so obviously welcome this app.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Try this it might be about a text box but it will be the same.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It may well be a hardware rather than just brightnest settings. My girlfriend had this issue with an old laptop and she had to get the converters replaced (i think). It was caused by the wires and the part itself getting trapped or dammaged in the hinge of the laptop or by being knocked too much.

That's one reason you might be having this problem. Take it to your local PC repair shop they will be able to tell you if that is the issue.

ChrisHunter 152 Posting Whiz in Training Featured Poster

What have you managed to do so far ? Can you post it in this thread so we can see if you're on the right track and try to help is we can ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

Nothing is fact, everything is opinion.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Just use the property name in your SQL statement. Might be different depending on what type of DB you're using but it should look something like this i think:

"INSERT INTO myTable (firstName) Values ('" + _firstname + "')";

I hope this helps at all

ChrisHunter 152 Posting Whiz in Training Featured Poster

So the problem isn't with the button, you just haven't written the code to make the button do something. Do you have any sample code we can look at ?

Have look at this

ChrisHunter 152 Posting Whiz in Training Featured Poster

Do you want to create a property in C#, for example a FirstName string property, set the property and store the value of that porperty in your database ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

can you post your query for us to look at please ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

I would suggest that you don't databind objects like comboBoxes and textBoxes because it means your program will be less flexible, I tried (or think i did) something similar to what you're doing and found databinding object meant i couldn't add particular functionality i wanted. If you databind an object rather than writing seperate methods for the occurence of particular event (in you case one event for when a record is clicked in the main form and a seperate method for when a record is clicked in the subform) your code may become messy and less managable.

More to the point of your issue I used this line of code to retrieve data from a spacific cell within a spacific row of the DGV and set it to a textBox:

textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

MCTS EXAM 70-433 Microsoft SQL Server 2008 - Database Development is a good book to look at, i'm using it at the moment and finding it very good.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Can you explain what type of lan you want (simple one, one with an internet connection, one that allows you to assign static IP addresses, a wireless LAN) ?

a simple LAN, just get a hub, couple of workstations and a couple of ethanet cables, plug each of the workstations into the hub and you've got a LAN, not a good one but it's a LAN

ChrisHunter 152 Posting Whiz in Training Featured Poster

I'm not a C programmer but the equasion should be something like:

variable1 = 78/8;
variable2 = (56*78) + variable1;

Deceptikon is right though something as simple as that shouldn't be hard to find on Google

ChrisHunter 152 Posting Whiz in Training Featured Poster

You can just set the ReadOnly property of the textBox to true and the user won't be able to edit it's contents, it's alot less work and more logical.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Go climbing, play Xbox, see the girlfriend or go the pub with a few friends.

ChrisHunter 152 Posting Whiz in Training Featured Poster

What type of database are you using (Sql server, Access, Oracle)? the best place to post this issue would be in the visual basic page or the database page.

You will also need to provide a lot more information on the issue you're having to help others identify a solution.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I didn't add anything i just re-arranged your code.

  • You can't define a method within another method.
  • Define all class instances at the top of your class.
  • Do some googling before hand, i did when i didn't know how to use Random class instead of groveling.

Hope this helps:

        Random random = new Random();

        static void Main(string[] args)
        {            
             int returnValue = RandomNumber(5, 20);
         }

         private int RandomNumber(int min, int max)
         {            
            return random.Next(min, max); 
         }
ChrisHunter 152 Posting Whiz in Training Featured Poster

I'm a Dell user and i 100% do care! top tip is if your battery, charger or HardDrive breakes . . . DON'T BY ONE FROM DELL !

For my XPS m1530

  • New battery from Dell = £100+ (i got one from eBay for £18 and it works perfectly);

  • New hard drive from Dell = alot on money (i took the one out of my partner's Acer because it just needs to be the same type e.g. Sata state);

  • New charger from Dell = alot of money (i just borrow my brother's for his Hp pavilion and it works fine);

Moral of the story - if your laptop is out of warrenty by after-market parts Dell unnecessarily expencive.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It depends on the programming environment you're using as to how you can use them. I use MS Visual Studios and there is a vertical grey bar to the left of the line numbers which you click and it inserts a break point on that position in your code. Once you have inserted the break point your code will run up to that point and stop to allow you to proceed line by line in order to see what is happening in the different lines of code.

It's priceless when you're trying to find bugs in a program.

ChrisHunter 152 Posting Whiz in Training Featured Poster

The red circles are break-points. if you run your app it will stop at those points. it allows you to step through your code to help locate the point at which your application throws an error (which is called debugging) you also use it to help understand how someone elses program works.

I've never had to use GetType() as of yet so i would be interested to know myself.

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

Do isolated tests on each component. Use your motherboard and everything else from your friends computer to check it isn't the motherboard, if your motherboard has more than 1 G-card slot swop the card to check it's not just the slot. check your monitor with your friends macheine too, sounds obvious but easily over-looked.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Ha true, you should still get some sort of display from the onboard graphics card. I've had a Google and some people who have had the same issue and found it could be that the motherboard is broken or isn't compatible with graphics card. It could also be that the card slot is not functioning correctly.

Try taking the new graphics card out and just using the onboard card to see if you get a display or you could use try inserting the card into a different mothorboard and vice-versa to see if it's a compatability issue or if one of them isn't working.

ChrisHunter 152 Posting Whiz in Training Featured Poster

It might sound daft but do you have the latest drivers installed ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

myComboBox.SelectedItem gets the value that you have selected from the comboBox. If you want to pass this value to another form you simply need to instanciate a new instance of the 2nd form in the 1st form and do the bellow:

Form2 frm2 = new Form2();

// This is done inside of a method
frm2.textBox1.Text = ComboBox.SelectedItem.ToString();
ChrisHunter 152 Posting Whiz in Training Featured Poster

A friend of mine lost his iPhone and tried to get it tracked but the people he called said they can but only if it's a missing persons problem but not if it's just a lost phone. thats in the UK though.

ChrisHunter 152 Posting Whiz in Training Featured Poster

you could make a lunch order system with a back end SQL server DB and a log in function which allows staff to login and order their luch.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Sorry if my last post seems quite rude, i've not had the best morning through no fault but my own.

I want my app and the database (which will be created by running an SQL script which i would like to do automatically when the application is run) installed on any workstation and the connection to be automatically generated if that makes sence?

thanks for your help

ChrisHunter 152 Posting Whiz in Training Featured Poster

Lightniing this is the 3rd time you've posted this article.

1 - Create your connection string. Get the name of the server you DB is on as well as the name of your DB and add them to your app.config file as shown below.

<connectionStrings>
        <add name="MyConnectionString"
            connectionString="Data Source=**SERVER-NAME-HERE** ;Initial Catalog=**YOUR-DB**;Integrated Security=True"
            providerName="System.Data.SqlClient" />
</connectionStrings>

2 - Create a DB connection method which references your connection string by name (shown below) which you should call when you want to carry out any database functions/ queries etc.

using System.Data.SqlClient;
using System.Configuration;

public SqlConnection Connect()
        {
            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = ConfigurationManager.ConnectionStrings["MyConnectionString"].ToString();

            try
            {
                conn.Open();
            }
            catch
            {
            }
            return conn;
        }

You don't need anymore than this to connect to your DB.

ChrisHunter 152 Posting Whiz in Training Featured Poster

With-out knowing the connection string of the server it is impossible to retrive the table.

I don't want to query a table because the script i want to execute creates the DB. i want to open SQL server (which i can do) retreive the server name (to complete the connection string) and then run an SQL script (without using the connection string because the DB does not exist yet) which will create the database (the name of the database will always be the same so that will already be in the connection string). As Lolafuertes said there is more than one server so this will be where my issue lies.

Thanks for your time and replys

ChrisHunter 152 Posting Whiz in Training Featured Poster

Put GO between SET and SELECT, failing that put GO between DECLARE, SET, SET and SELECT.

The GO key word tells it that it is executing something that is in a different batch, you have to use it if you're creating schemas and tables in the same script so i guess it's worth a try . . .

let me know how it goes.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I'd say it takes determination rather than love, Codeorder you sould have been a philosopher, my thoughts are 'It's too early to be getting up', 'i hate traffic' and i wonder what's for dinner'.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I was wondering if there is a way to open an SQL file and execute it from a c# application without prior connection to a database and also get the name of the default server that is used when SSMS is opened.

at the moment i can open SSMS but i can't for the life of me figure out how to get the server name as well as opening and running an SQL file which is a DB creation script.

The reason i ask is because i've been trying to add a function, that will run if there isn't a complete connection string, that will open SSMS, retrieve the servername and execute an SQL script to create a DB.

this is just for a personal interest and would appreciate the help

Thanks in advance

PIECE !

ChrisHunter 152 Posting Whiz in Training Featured Poster

Some data types need you to define the seed number or how many decimal places you want to store. Taking this into account do some research on the decimal datatype as you have to define how many decimal places you want to store if you want to use decimal datatype.

ChrisHunter 152 Posting Whiz in Training Featured Poster

"You've got red on you . . ." - Sean of the dead

ChrisHunter 152 Posting Whiz in Training Featured Poster

if you're creating a new database it is just added to the list that master is in e.g. the list would read:
-collegeDB
-master
-myDB1

if you want to move all data from one DB to another you may have to bulk move everything over in an SQL statement. If you have the SQL script that creates the DB that contains the data you want too move over, simply alter the "CREATE DATABASE DBName;" statement.

ChrisHunter 152 Posting Whiz in Training Featured Poster

can you not give the <p> tag an ID attribute and then use that ID to reference the text attribute of the <p> tag ?

ChrisHunter 152 Posting Whiz in Training Featured Poster

If you're still interested, in the left screen grab you've highlight all but there WHERE clause which means that only the highlighted code will be executed and nulls will be returned.

ChrisHunter 152 Posting Whiz in Training Featured Poster

The Access DateTime format might be different to the C#.NET DateTime format, this is the case with SQL Server. try to research both C#.NET and Access DateTime format and try to figure out how to convert the C# DateTime so that it can be stored in the DB.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Llyn Gwynant Campsite is a good campsite, it has it's own lake that you can rent kayaks to use on the lake too.

I'd rather be outdoors whether it be going to the local climbing wall, camping or just going the pub but finding the time, people and weather (which isn't often in N/W England) so i spend alot of time (more than i'd like to) online on a games console etc.

ChrisHunter 152 Posting Whiz in Training Featured Poster

Hi bhaga,

I tried to do something similar in the past but could only manage to get the windows identity of the current windows user and not the password. It might be better security purposes to get the user to create a new password different to the one they use to log into their work station.

to get the windows identity i did this:

WindowsIdentity.GetCurrent().Name.ToString();

then simply stored it in a users table in the SQL server DB with the password entered by the user on a registration form.

Hope this helps

ChrisHunter 152 Posting Whiz in Training Featured Poster

Yeah sorry thats the one, I forgot paste the error.

ChrisHunter 152 Posting Whiz in Training Featured Poster

I just got an error when I clicked on the tutorials tab on the ASP.NET page, is this just something to do with my settings or is it an issue ?

Cheers

ChrisHunter 152 Posting Whiz in Training Featured Poster

7.25 hours of 1 man sniffing and rubbing a hole in the thys of his pants (top of, nothing dirty) in 1 ear and Calvin Harris in the other.

ChrisHunter 152 Posting Whiz in Training Featured Poster

so a user can register twice as long as they choose a different username ?

Best thing to do to stop the same username being chosen more than once is to make the column UNIQUE in the definition of the table in the DB.

The alternative if to take the username the user wants and do a SELECT COUNT() something like this:

"SELECT COUNT(columnName) FROM TableName WHERE columnName = '" + requestedName + "'"; 

which will count the amount of times the requestedName is in the column of the DB stated in the COUNT() part of the statement.