Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ServerEXE
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Server());
        }
    }
}


What I have tried:

please solve
String to Int error in asp.net c# testing
Posted
Updated 26-Jan-20 21:47pm
v2
Comments
Maciej Los 27-Jan-20 5:36am    
Not a question at all!
Your code is NOT related to the request (Please solve String to Int error in asp.net c# testing).
You need to provide more information about your issue and paste code related to the issue.

1 solution

This is a guess - because we have no idea what line it's on, or what your data looks like that's all it can be - start here:
C#
rks = Convert.ToInt32(dr[0]["MstKeyStrokes"].ToString());
It the cell contains a non-numeric string, you will get a conversion error. I'd strongly suggest you use int.TryParse instead of the Convert methods as they allow you to detect errors and respond sensibly to them instead of just crashing.

But without your code to run and the data it runs with, that's the best we can do.
So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. If you don't know how to use it then a quick Google for "Visual Studio debugger" should give you the info you need.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900