.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 24th, 2005, 04:16 AM
joostingh joostingh is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 1 joostingh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 22 sec
Reputation Power: 0
[C#] using args

Code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Xml;
using System.IO;
using WindowsApplication1.nu.realtime.webservices;

namespace WindowsApplication1
{
    /// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button button1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		
		private AuthHeader Credentials = new AuthHeader();
		private Historical History = new Historical();
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.TextBox textBox5;
		private XmlNode Result;	

				
		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//

		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
// code from VS.NET

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args) 
		{
			Application.Run(new Form1());		
		
			string ID = args[0];
			string StartTime = args[1];
			string EndTime = args[2];
			string Flags = args[3];        		

			
		}


	

		private void button1_Click(object sender, System.EventArgs e)
		{


			Credentials.Community = "RealTime\\Vermeer";
			Credentials.UserIdentity = "Realtime\\Vermeer";
			Credentials.Password = "******";

			History.AuthHeaderValue = Credentials;
			
			Result = History.VehicleHistory(4248, "2005-05-01 00:00:00", "2005-05-2 23:00:00", 1);	

			textBox1.Text = Result.InnerXml.Replace(">",">/r/n");

			// De waardes die ik heb in de textbox weg gaan schrijven in een outputfile.
			StreamWriter fi = new StreamWriter("C:\\Outputfile.txt");
			fi.Write(textBox1.Text);
			fi.Close();
			
			Close();
		}
	}
}


Hello this is my first time here...

I am supposed to make a simple program which is used by another (C++) program for getting data of the internet. Well the date is going well but now I need to use the program without seing it. Thats why I want to use args for starting the program and let the program do his thing.

Here are my questions:

1) How can I use the args as they are. I need them to get the right data of the internet.

2) How can I let the program use the code from Button1_click without clicking on the button with my mouse.

Tnx in advance.

Reply With Quote
  #2  
Old July 24th, 2008, 08:16 PM
eddyj eddyj is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2008
Posts: 1 eddyj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 42 sec
Reputation Power: 0
i was actually creating events today, okay so you want to fire up the event without having the user click it? Events are basically functions, thats why they are implemented using delegates. to activate an event you simple put in the name of your event handler and the parameters. I just built a form with one button on it. Now this the simple code for it in C#:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Eventexample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            button1.Click +=new EventHandler(button1_Click);
            InitializeComponent();
        }
        // event handle
        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Event Triggered");//to display the event being triggered
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            button1_Click(sender, e);
        }
    }
}

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > [C#] using args


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT