2 Replies - 6822 Views - Last Post: 19 January 2009 - 02:30 PM Rate Topic: -----

#1 DJ24966  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 16-January 09

Change Title Bar text after opening file

Posted 19 January 2009 - 02:03 PM

I know I ask alot of questions, but thats how we learn, asking questions, and trial and error, and well, I guess thats why this forum is here :P

I'm trying to get my Applications title bar to change the text once the user loads up a file. So far I have gotten it so it will load up the File name into the title bar, but I would like it to show MicroText - OpenFileName... OpenFileName being the name of the file that was opened.

		OpenFile.ShowDialog()
		Dim fname As String = OpenFile.FileName
		Dim micro As String = MicroText.Name
		If System.IO.File.Exists(fname) Then
			Dim read As New System.IO.StreamReader(fname)
			MicroText.Text = read.ReadToEnd
			read.Close()
			Me.MicroText.Name() = Path.GetFileName(OpenFile.FileName)
			Me.Text() = Path.GetFileName(OpenFile.FileName)
		Else

		End If



Is This A Good Question/Topic? 0
  • +

Replies To: Change Title Bar text after opening file

#2 kasbaba  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 133
  • Joined: 03-November 08

Re: Change Title Bar text after opening file

Posted 19 January 2009 - 02:13 PM

Hi,

If you need the Text "Microtext" to be inserted before the filename try this:

Me.Text() = "Microtext - " & Io.Path.GetFileName(OpenFile.FileName)


OR

Me.Text() = "Microtext - " & IO.Path.GetFileNameWithoutExtension(OpenFile.FileName)


however if you need the Text inside Microtext (I suppose its a textbox) then :

Me.Text() = Microtext.text.tostring & " - " & Path.GetFileName(OpenFile.FileName)


OR

Me.Text() = Microtext.text.tostring & " - " & IO.Path.GetFileNameWithoutExtension(OpenFile.FileName)


hope this helps !

kasbaba
Was This Post Helpful? 1
  • +
  • -

#3 DJ24966  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 16-January 09

Re: Change Title Bar text after opening file

Posted 19 January 2009 - 02:30 PM

Thanks alot!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1