本文介绍了如何使用ReadLine从VCF转换为文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我回来了...

V卡:

hello, I am back...

The V-Card:

BEGIN:VCard
VERSION:2.1
N:'T GROENE HART
FN:
TEL;WORK;VOICE:0505420369
TEL;WORK;VOICE:0505420369
TEL;HOME;VOICE:06-12345678
TEL;CELL;VOICE:06-12345678
TEL;VOICE:0512 342040
TEL;WORK;FAX:0512 342040
TEL;FAX:0512 342040
ADR;WORK;PREF:;;Straat 34;HoutJE;;8765 AF
ENCODING=QUOTED-PRINTABLE:Straat 34
URL;HOME:www.biss.nu
URL;WORK:www.biss.nu
EMAIL;PREF;INTERNET:Jan@home.nl
END:VCARD




我想逐行阅读..
仅显示用户给出的答案(信息).
vcf文件必须转换为文本框..我已经开始了,但是无法正常工作.. ::




I want to read line by line..
only display the answers (info) given by the user.
vcf file must be converted to a textbox.. I have made a beginning, but it doesn''t work jet ..:

'Private Sub voor het importeren van een V-Card:
    Private Sub Importeren() _
        Handles itemImporteerVCard.Click, mnuImportVCard.Click, btnImportVCard.Click 'Alle knoppen voor het importeren.

        'Naam en locatie van het bestand:
        Dim strBestand As String = "C:\Test.vcf"
        Dim objReader As New System.IO.StreamReader(strBestand)

        Dim strBuffer As String = ""
        Dim strRegel As String = ""


        'Eigenschappen voor het openen van de V-Card:
        ofdImport.Filter = "V-Cards (*.vcf)|*.vcf"
        ofdImport.FileName = "*.vcf"
        ofdImport.Title = "V-Card importeren"

        'Bevestiging voor het importeren:
        If ofdImport.ShowDialog = System.Windows.Forms.DialogResult.OK Then

            frmVCard.Show()

            frmVCard.txtVCard.Text = objReader.ReadLine
            Do While Not objReader.EndOfStream
                frmVCard.txtVCard.Text = frmVCard.txtVCard.Text & vbCrLf & objReader.ReadLine(strBuffer)
                If strBuffer = Nothing Then
                    frmVCard.Close()
                End If

            Loop
            objReader.Close()

        End If
    End Sub




我读了一篇我不理解的文章,所以希望有人可以向我解释如何使这个项目取得良好的结果.

这是我读过的文章:

http://www.vbforums.com/archive/index.php/t-373612.html [^ ]

感谢和问候!




I have read an article that I just don''t understand, so I hope that there is someone who can explain me how to make this project to a good result.

This is the article i have readed:

http://www.vbforums.com/archive/index.php/t-373612.html[^]

thanks and greets!

推荐答案

Dim sFileName As String = String.Empty, sLine As String = String.Empty, sCols() As String = Nothing
Dim objReader As System.IO.StreamReader = Nothing

Try
    sFileName = "F:\myCard.vcf"
    Me.Label1.Text = sFileName & vbCrLf & vbCrLf
    objReader = New System.IO.StreamReader(sFileName)
    Do While objReader.Peek >= 1
        sLine = objReader.ReadLine()
        sCols = sLine.Split(":") 'split text by :
        Me.Label1.Text = Me.Label1.Text & sCols(1) & vbCrLf
    Loop
    objReader.Close()

Catch ex As Exception
    MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error...")
Finally
    objReader.Dispose()

End Try


这篇关于如何使用ReadLine从VCF转换为文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:07