Error returned all threads accessing

Class library usage, coding and language questions.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Error returned all threads accessing

Post by omayer » Wed May 16, 2012 7:09 pm

where will I enter "SetApartmentState(ApartmentState.STA);" on below's code since i am getting error
STA.jpg
STA.jpg (42.9 KiB) Viewed 2179 times

Code: Select all

namespace PeoplesoftConsoleApps
{
	class Program
	{
[STAThread]


public static int Main(string[] args)
{	
	// TODO: Add Code to call testing functions - for example:	
	// Automation.Start()
			
#region |Object Instantiate|		
		ProcessStartInfo startInfo = new ProcessStartInfo(); 			 
		PageLoadValidation pageLoadValidation =new PageLoadValidation();
#endregion

			
#region |Console size and Beep|		
			Console.BackgroundColor = ConsoleColor.Green;
			Console.ForegroundColor = ConsoleColor.Blue;
			Console.Beep();
			Console.SetWindowSize(Console.LargestWindowWidth, Console.LargestWindowHeight);

#endregion
			
#region |Console Prompt|			
		   Console.WriteLine("Enter FSQA or FSQB or FSTEST:");
		    string testUrl  = Console.ReadLine(); // Read string from console  			
           	string testRmxUrl = testUrl; // Read string from console  	
           	 
            Console.WriteLine("Enter Peoplesoft User ID:");
		 	string loginId = Console.ReadLine(); 
		 	Console.WriteLine("Enter Password:");
            string passWord = Console.ReadLine(); 
  			
                       Console.ResetColor();
#endregion
Tipu

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: Error returned all threads accessing

Post by omayer » Wed May 16, 2012 9:23 pm

Ok , no more error if i named the object inside the MAIN
Tipu