2016-03-24 14 views
0

私は支援が必要です...私はそこにリンクを含むテキストファイルを作成しようとしています。私が持っているコード..VB.Net "新しい行" "文字列"を作成する

dim domain as string = "http://www.mywebsite/" 
dim name as string = "username" 
Dim link As String = New String("domain" & "name") 
       TextBox1.AppendText(link & Environment.NewLine) 
Msgbox(textBox1.lines(0)) 

問題は、MsgBoxには唯一の「http://www.mywebsite/」として表示されていることです。テキストボックスには「http://www.mywebsite/username」を示していますが、テキスト文書にコピーされたとき、それは次のとおりです。 線0:http://www.mywebsite/ ライン1:ユーザ名 任意のアイデア...私は のMsgBox(textBox1.linesが必要 Dim link As String = String.Join(domain & name)を使用してみましたが、そのdoesntの仕事も Dim link As String = new String.Join(domain & name) を行います(0))に「http://www.mywebsite/username」と表示されません。

答えて

0

これはすばやく使用しているというメッセージが表示されました。 Dim link As String = String.Concat(domain & name)

0

は、私はあなたが私はあなたが正確に

必要なものを理解didntの

'create a string with multiple lines 
Dim a As New StringBuilder 
a.AppendLine("hi") 
a.AppendLine("there") 
a.AppendLine("this") 
a.AppendLine("is") 
a.AppendLine("a") 
a.AppendLine("test") 

'read will makes read line by line 
Dim read As String() = a.ToString.Split(vbNewLine) 
'count has number of lines 
Dim count As Integer = a.ToString().Split(vbNewLine).Length - 1 

'lines will be added to combobox one by one 
For i As Integer = 0 To count - 1 
    ComboBox1.Items.Add(read(i)) 
Next 

あなただけのスーツにあなたのニーズにそれを編集する必要がありStringBuilderの最初のインポートに輸入System.Textのを移動すべきだと思います

関連する問題