[SOLVED] Creating File

Itīs quite hard to descripe...

Page 1 of 1

7 Replies - 558 Views - Last Post: 19 December 2008 - 08:15 AM Rate Topic: -----

#1 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

[SOLVED] Creating File

Posted 18 December 2008 - 12:09 PM

Hi!

I have a problem with a program that i am making, it is a program that displays a pop-up, and lets the user select the type of it, the message and the title. (Apparently i cant show a screenie of it)

Now, the problem is that i want the user to be able to save their own message box (pop-up), and thats the thing i dont know how to do.

I have the codes to display the pop-up in visual basic:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		MsgBox(Message.Text, MsgBoxStyle.OkOnly, txtName.Text)

Now, i have created the program to work like this, the user writes his message in one textbox (Message.text), the user writes its title in another box (txtName), and then press a button, which displays the pop up, and contains the code on how to box looks(MsgBoxStyle.OkOnly, for example)

Now i want to know how to make the user able to save their pop-up, with their own text and title from the textboxes, but since i have buttons to create the "effects" on the pop-ups, this is hard.

I have been fooling around with some codes, for example:
Dim savef As New System.IO.StreamWriter("c:/users/User/desktop/Pop-Up.vbs")
		savef.Write(TextBox1.Text)
		savef.Close()

But then i dont get the necessary things in, like the:
msgbox "textbox in here",48,"Titlebox in here"

and i dont get to change the "effects".

PS: I want it to be saved as a .vbs.

Now this ended up really bad, but i hope someone understands it.

If anyone has a clue about this, or can give me a hint, please answer this post.

Thanks

// Zooms



Yeah, and the
msgbox "Messagebox in here",48,"titlebox here"
is a .vbs script, that you use notepad
to write, thats what i want to save it as.

This post has been edited by Zooms: 19 December 2008 - 08:17 AM


Is This A Good Question/Topic? 0
  • +

Replies To: [SOLVED] Creating File

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: [SOLVED] Creating File

Posted 18 December 2008 - 01:29 PM

Convert the MsgBoxStyle integer to a string. Then write 3 string triplets to your file.
...
savef.WriteLine(TextBox1.Text)
savef.WriteLine(MsgBoxStyleIntegerString)
savef.WriteLine(Titlebox.Text)
...


Was This Post Helpful? 0
  • +
  • -

#3 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Re: [SOLVED] Creating File

Posted 19 December 2008 - 01:59 AM

View Postn8wxs, on 18 Dec, 2008 - 12:29 PM, said:

Convert the MsgBoxStyle integer to a string. Then write 3 string triplets to your file.
...
savef.WriteLine(TextBox1.Text)
savef.WriteLine(MsgBoxStyleIntegerString)
savef.WriteLine(Titlebox.Text)
...



Ok, thanks :) Im going to try it when i get home.
Was This Post Helpful? 0
  • +
  • -

#4 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Re: [SOLVED] Creating File

Posted 19 December 2008 - 05:42 AM

Hm, the one you told me is good, but unfortionally i cant use it because i need all of the text
to be written in one line.

However, i tried this:
savef.WriteLine("msgbox """, MsgBox.Text, """,48,""", TitleBox.Text, "")
		savef.Close()

The reason for all the ":s is because the code has to be
msgbox "Your message here",48,"Your title here"

like that to work.

But the first code i wrote does only create a .vbs file with this: msgbox "

The rest does not come with.
Anyone knows how to fix it?
Was This Post Helpful? 0
  • +
  • -

#5 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: [SOLVED] Creating File

Posted 19 December 2008 - 06:43 AM

 
savef.WriteLine("msgbox """, MsgBox.Text, """,vbOKOnly,""", TitleBox.Text, "")
savef.Close()


Was This Post Helpful? 0
  • +
  • -

#6 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Re: [SOLVED] Creating File

Posted 19 December 2008 - 07:00 AM

View Postn8wxs, on 19 Dec, 2008 - 05:43 AM, said:

 
savef.WriteLine("msgbox """, MsgBox.Text, """,vbOKOnly,""", TitleBox.Text, "")
savef.Close()



I still only get this written in my file: msgbox "

The rest doesnt seem to work, really weird...

I also tried with a .txt file instead of a .vbs, but i only get the: msgbox "
Was This Post Helpful? 0
  • +
  • -

#7 Malcontent  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 2
  • Joined: 19-December 08

Re: [SOLVED] Creating File

Posted 19 December 2008 - 07:38 AM

		savef.WriteLine("msgbox """ + MsgBox.Text + """,vbOKOnly,""" + TitleBox.Text + "")
		savef.Close()



try that?
Was This Post Helpful? 1
  • +
  • -

#8 Zooms  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 78
  • Joined: 04-December 08

Re: [SOLVED] Creating File

Posted 19 December 2008 - 08:15 AM

View PostMalcontent, on 19 Dec, 2008 - 06:38 AM, said:

		savef.WriteLine("msgbox """ + MsgBox.Text + """,vbOKOnly,""" + TitleBox.Text + "")
		savef.Close()



try that?



Thank you so much! :) It works!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1