Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien

[VB.net] Spaties in aguments

Pagina: 1
Acties:

  • RedCellNL
  • Registratie: September 2003
  • Laatst online: 11-04-2024
Hallo allemaal,

Ik wil gaag meerdere argumenten (met spaties) gebruiken als output. Het werkt wel zonder de spaties maar niet met de spaties. Hoe kan ik toch spaties gebruiken zodat het goed gaat?

Visual Basic .NET:
1
2
3
4
5
6
7
8
9
10
11
12
            Dim process As New Process()
            Dim FileName As String = "notepad"
            Dim Arguments As String = TextBox1.Text & " " & TextBox2.Text
            process.StartInfo.UseShellExecute = False
            process.StartInfo.RedirectStandardOutput = True
            process.StartInfo.RedirectStandardError = True
            process.StartInfo.CreateNoWindow = True
            process.StartInfo.FileName = FileName
            process.StartInfo.Arguments = Arguments
            process.Start()
            Dim output As String = process.StandardOutput.ReadToEnd()
            TextBox3.Text = output


Bedankt

[ Voor 1% gewijzigd door BtM909 op 31-10-2013 10:44 ]


  • sorted.bits
  • Registratie: Januari 2000
  • Laatst online: 22-11 13:21
Er aan gedacht dat je quotes om je arguments heen kan zetten? Via de command-line doe je neem ik aan het zelfde.

  • RedCellNL
  • Registratie: September 2003
  • Laatst online: 11-04-2024
Klopt, maar dan pakt ie letterlijk TextBox1.Text ipv de waarde.

  • Snake
  • Registratie: Juli 2005
  • Laatst online: 07-03-2024

Snake

Los Angeles, CA, USA

code:
1
Dim Arguments As String = String.Format("{0} {1}", TextBox1.Text, TextBox2.Text)

Going for adventure, lots of sun and a convertible! | GMT-8


  • RedCellNL
  • Registratie: September 2003
  • Laatst online: 11-04-2024
Bedankt, voor notepad gaat dit goed. Voor een executable gaat het mis.

Ik heb een bestand, "Bestand 5.tmp" welke wordt gezien als "Bestand".

Invalid argument 5.tmp at parameter index 3 in command line C:\Files\Bestand 5.tmp

Als ik er in TextBox1 quotes omheen zet gaat het goed.

[ Voor 17% gewijzigd door RedCellNL op 31-10-2013 10:36 ]


  • BtM909
  • Registratie: Juni 2000
  • Niet online

BtM909

Watch out Guys...

RedCellNL schreef op donderdag 31 oktober 2013 @ 10:35:
Als ik er in TextBox1 quotes omheen zet gaat het goed.
Laat dat dan ook even zien met relevante regels code ;)

Code kan je tussen [code=vb.net][/] tags plaatsen :)

Ace of Base vs Charli XCX - All That She Boom Claps (RMT) | Clean Bandit vs Galantis - I'd Rather Be You (RMT)
You've moved up on my notch-list. You have 1 notch
I have a black belt in Kung Flu.


  • RedCellNL
  • Registratie: September 2003
  • Laatst online: 11-04-2024
:)
Nee ik bedoel als de app gestart is . In de code heb ik het nog niet werkend.

  • edeboeck
  • Registratie: Maart 2005
  • Laatst online: 20-11 12:23

edeboeck

mie noow noooothing ...

Visual Basic .NET:
1
Dim Arguments As String = String.Format("""{0}"" ""{1}""", TextBox1.Text, TextBox2.Text)
Als je letterlijk ook de quotes wilt tonen, moet je zorgen dat ze mee in je output zitten. Vandaar de dubbele quotes om in de output enkele te bekomen.

  • RedCellNL
  • Registratie: September 2003
  • Laatst online: 11-04-2024
edeboeck schreef op donderdag 31 oktober 2013 @ 10:47:
Visual Basic .NET:
1
Dim Arguments As String = String.Format("""{0}"" ""{1}""", TextBox1.Text, TextBox2.Text)
Als je letterlijk ook de quotes wilt tonen, moet je zorgen dat ze mee in je output zitten. Vandaar de dubbele quotes om in de output enkele te bekomen.
Yes, werkt. Thanks!
Pagina: 1