Reputation: 372
i doing firstime consoleapplication. I have WinformApp, and i copy code to ConsoleApp. I have problem, i don´t know how could i jump from static void Main to public static void Sending. This is SAMPLE of my code...
class Program
{
static void Main(string[] args)
{
int counter; //Counter pro export
int counterchyba;
string strediska = "0003,0005";
}
public static void Sending(int counter, int counterchyba, string strediska)
{
var c = (counter).ToString().PadLeft(5, '0');
SqlCommand cmd = new SqlCommand();
.........
}
}
Have you any idea how could it right?
Upvotes: 0
Views: 534
Reputation: 11577
in the main function you can call the code of sending like so:
class Program
{
static void Main(string[] args)
{
int counter; //Counter pro export
int counterchyba;
string strediska = "0003,0005";
Sending(0, 0, strediska);
}
public static void Sending(int counter, int counterchyba, string strediska)
{
var c = (counter).ToString().PadLeft(5, '0');
SqlCommand cmd = new SqlCommand();
.........
}
}
however, i don't know what the point of Sending
function parameters: counter
, counterchyba
and strediska
so you need to figure out what to put in them
One more important thing:
you said this is a consoleapplication and that you started a WinformApp. don't do it, it will end in problems that will take days to solve. start a new solution, a console application.
Upvotes: 1
Reputation: 4768
In your Main
you can literally just call Sending(counter, counterchyba, strediska);
Main is where it all starts. You can initiate any actions from there.
Upvotes: 6