'Parsing text in textbox VB
I have data from Text file and copy textbox to like :
Booking Details / Detail Pemesanan
Booking ID/ Booking ID 78B8MMRZX67
Booking Status/ Status Booking ISSUED
Booking Time / Waktu Booking 05-04-2022 (7:26)
Booking Expiration Time / Waktu Berakhir Booking 05-04-2022 (8:26)
Passenger Details / Detail Peminjam
Name / Nama Fidelia Ariadne Radi
Phone Number / Nomor Telepon Peminjam +66821866961
Supplier Info / Info Penyedia
Company Name / Nama Perusahaan Jayamahe Easy Ride Bali
Phone Number / Nomor Telepon +628179094919
Route / Rute DPS - Legian
Pick Up Location / Lokasi Jemput Ngurah Rai International Airport (DPS), Denpasar, Indonesia
Pick Up Location Note / Catatan Lokasi Jemput -
Drop Off Location / Lokasi Antar Loft Legian Hotel, Jl. Melasti No.99, Legian, Kec. Kuta, Kabupaten Badung, Bali 80361, Indonesia
Drop Off Location Note /Catatan Lokasi Antar -
Special Requests / Kebutuhan Khusus -
Flight Number / Nomor Penerbangan 3K - 241
Pick Up Time / Waktu Jemput Tuesday, 05 Apr 2022
14:00
Car Type / Jenis Mobil Jayamahe Budget MPV
Inventory Type / Jenis Inventori Standard
Passenger Capacity / Jumlah Penumpang 4
Baggage Capacity / Jumlah Bagasi 4
Number of Car / Jumlah Mobil 1
I Made generate from VB like:
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim lines() As String = TextBox1.Text.Split(CChar(Environment.NewLine))
' Dim name As String = lines(0).Replace("Name: ", "")
' Dim maths As Integer = CInt(lines(1).Replace("Maths: ", ""))
' Dim english As Integer = CInt(lines(2).Replace("English: ", ""))
Dim idbooking As String = lines(1).Replace("Booking ID/ Booking ID ", "")
Dim wkbooking As String = lines(3).Replace("Booking Time / Waktu Booking ", "")
Dim expiredbooking As String = lines(4).Replace("Booking Expiration Time / Waktu Berakhir Booking ", "")
Dim nd As String = TextBox3.Text
Dim jenismobil As String = lines(20).Replace("Car Type / Jenis Mobil Jayamahe ", "")
Dim Jumlahmobil As String = lines(24).Replace("Number of Car / Jumlah Mobil ", "")
Dim rute As String = lines(11).Replace("Route / Rute ", "")
Dim flight As String = lines(17).Replace("Flight Number / Nomor Penerbangan ", "")
Dim nama As String = lines(6).Replace("Name / Nama ", "")
Dim hp As String = lines(7).Replace("Phone Number / Nomor Telepon Peminjam ", "")
Dim wkjemput As String = lines(18).Replace("Pick Up Time / Waktu Jemput ", "")
Dim timejemput As String = lines(19).Replace(" ", "")
Dim lokasijemput As String = lines(12).Replace("Pick Up Location / Lokasi Jemput ", "")
Dim lokasiantar As String = lines(14).Replace("Drop Off Location / Lokasi Antar ", "")
Dim note1 As String = lines(13).Replace("Pick Up Location Note / Catatan Lokasi Jemput ", "")
Dim note2 As String = lines(16).Replace("Special Requests / Kebutuhan Khusus ", "")
Dim note3 As String = lines(15).Replace("Drop Off Location Note /Catatan Lokasi Antar ", "")
Dim note4 As String = lines(16).Replace("Special Requests / Kebutuhan Khusus ", "")
Dim jumlahpenumpang As String = lines(22).Replace("Passenger Capacity / Jumlah Penumpang ", "")
Dim jumlahbagasi As String = lines(23).Replace("Baggage Capacity / Jumlah Bagasi ", "")
TextBox2.Text = "ID VOUCHER " + vbNewLine &
idbooking + vbNewLine &
"Waktu Pesanan : " + wkbooking + vbNewLine &
"Expired : " + expiredbooking + vbNewLine &
"Status : New" + vbNewLine + vbNewLine &
"*ND : " + nd + "*" + vbNewLine &
"Detail Pesanan" + vbNewLine &
"TRAVELOKA. Shuttle Car " + vbNewLine &
"Bali AT" + vbNewLine + vbNewLine &
"*Tipe Mobil :" + jenismobil + "*" + vbNewLine &
"Jumlah Mobil : " + Jumlahmobil + vbNewLine + vbNewLine &
"*Rute: " + rute + "*" + vbNewLine &
"*Flight No : " + flight + "*" + vbNewLine &
"Detail Penumpang " + vbNewLine &
nama + vbNewLine &
"*" + hp + vbNewLine + vbNewLine &
"Waktu Jemput : " + wkjemput + vbNewLine &
"*Pukul : " + timejemput + " " + ComboBox1.Text + "*" + vbNewLine &
"Lokasi Jemput " + vbNewLine &
lokasijemput + vbNewLine + vbNewLine &
"Note " + note1 + vbNewLine &
note2 + vbNewLine + vbNewLine &
"Lokasi Antar" + vbNewLine &
lokasiantar + vbNewLine &
"Note " + note3 + vbNewLine &
note4 + vbNewLine + vbNewLine &
"Jumlah Penumpang :" + jumlahpenumpang + vbNewLine &
"Jumlah Bagasi :" + jumlahbagasi + vbNewLine
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
CopyAllMyText()
End Sub
Public Sub CopyAllMyText()
TextBox2.SelectAll()
' Copy the contents of the control to the Clipboard.
TextBox2.Copy()
End Sub
End Class
Please help me to get result like this:
ID VOUCHER
78B8MMRZX67
Waktu Pesanan :
05-04-2022 (7:26)
Expired :
05-04-2022 (8:26)
Status : New
*ND : 560000*
Detail Pesanan
TRAVELOKA. Shuttle Car
Bali AT
*Tipe Mobil :Budget MPV*
Jumlah Mobil :
1
*Rute: DPS - Legian*
*Flight No : 3K - 241*
Detail Penumpang
Fidelia Ariadne Radi
*66821866961*
Waktu Jemput :
Tuesday, 05 Apr 2022
*Pukul : 14:00 WIT*
Lokasi Jemput
Ngurah Rai International Airport (DPS), Denpasar, Indonesia
Note
-
-
Lokasi Antar
-
Jumlah Penumpang :4
Jumlah Bagasi :4
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
