3 Replies - 1718 Views - Last Post: 28 December 2008 - 11:42 PM Rate Topic: -----

#1 koeshkoesh  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 59
  • Joined: 27-December 08

VB 2008 Load .Txt on start

Post icon  Posted 28 December 2008 - 03:49 PM

Hello, before i posted a topic about how to save user settings. i've been doing this by using a .txt file... now i want this .txt to load on the form startup so the settings will load automatic

sorry i am so newbie. couldn't find any posts about this yet.

thanks, greets koeshkoesh
Is This A Good Question/Topic? 0
  • +

Replies To: VB 2008 Load .Txt on start

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2271
  • View blog
  • Posts: 9,499
  • Joined: 29-May 08

Re: VB 2008 Load .Txt on start

Posted 28 December 2008 - 06:09 PM

In the Solution Explorer, show all files.
Expand the Application.myapp
Below this there will be a document called Application.Designer.vb
View Code
In the MyApplication events, there is is an event called startup.

The is one of the first, if not the first event, to fire in your application.
From here you can access the command line arguments passed to your application. e.CommandLine
Stop your application from starting up by setting e.cancel=true

I suggest you place the code to read the text file here.
Was This Post Helpful? 0
  • +
  • -

#3 koeshkoesh  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 59
  • Joined: 27-December 08

Re: VB 2008 Load .Txt on start

Posted 28 December 2008 - 11:30 PM

   Partial Friend Class MyApplication
		
		<Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
		Public Sub New()
			MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
			Me.IsSingleInstance = false
			Me.EnableVisualStyles = true
			Me.SaveMySettingsOnExit = true
			Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
		End Sub
		
		<Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
		Protected Overrides Sub OnCreateMainForm()
			Me.MainForm = Global.*********.Form1

		End Sub
	End Class
End Namespace 


this is all what it shows here... no startup things or anything
so i dunno were to put it.... can you point me?
Was This Post Helpful? 0
  • +
  • -

#4 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Re: VB 2008 Load .Txt on start

Posted 28 December 2008 - 11:42 PM

If the Startup event handler is not present in the code, you can add it by selecting the MyApplication Events from the Class selection section and then selecting the Startup event from the Event Handlers list.

Posted Image
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1