Page 1 of 1

Error returned all threads accessing

Posted: Wed May 16, 2012 7:09 pm
by omayer
where will I enter "SetApartmentState(ApartmentState.STA);" on below's code since i am getting error
STA.jpg

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

Re: Error returned all threads accessing

Posted: Wed May 16, 2012 9:23 pm
by omayer
Ok , no more error if i named the object inside the MAIN