Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Another question:

My application can make a V-Card.
The user of my app can open a V-Card in Outlook.

I want to open the V-Card in my app.
I have heard that this possible with a Instr ?? or something like that.. never heard from it so this is what I have to know:

CSS
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


I want to open a Textfile.vcf with my app.. when I open this file I want to show only the informatie of the user in this file.. how can i show the information without the things to get the info..ehm i mean the things before : @ each line..

can anyone help me with that?
thanks!
Posted

You have to read the file and parse its lines in order to extract meaningful (to you) info (have a look at Regex class documentation[^]).
 
Share this answer
 
Comments
VJ Reddy 21-May-12 9:06am    
Good suggestion. 5!
OdeJong 21-May-12 9:45am    
hmm.. thanks for your answer, but I don't understand that "parse".. method.. ma by you can give me an example of it?
OdeJong 22-May-12 4:27am    
Can I do this in another way? ehm something like this:

I want to read the Textfile.. if this file is starting with "BEGIN:VCARD" then go to a new Line, if second line is starting with Version.. Then going tot the 3d line..

Then ehm..N = Name ( The name of the user) so The name must replace "N"
Firstname replace FN

TEL;WORK;VOICE:0505420369 (replace..)
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
(replace till this line)
Write the information above tot TextBox and go to new line..

END:VCARD (if last line is something like startswith "this"..then reading and writing is done, the vcard will show in textBox..

do you know how to do this?
If you mean to replace the content of each line before : then the following code can be used
VB
Dim infos As String() = System.IO.File.ReadAllLines("TextFile.vcf")
Dim modifiedInfos As String() = infos.[Select](Function(ln) _
        If(ln.Contains(":"C), ln.Substring(ln.IndexOf(":"C) + 1), ln)).ToArray()
System.IO.File.WriteAllLines("modTextFile.vcf", modifiedInfos)

'Output for the info given in the question
'VCard
'2.1
''T GROENE HART
'
'0505420369
'0505420369
'06-12345678
'06-12345678
'0512 342040
'0512 342040
'0512 342040
';;Straat 34;HoutJE;;8765 AF
'Straat 34
'www.biss.nu
'www.biss.nu
'Jan@home.nl
'VCARD
 
Share this answer
 
v2
Comments
OdeJong 21-May-12 9:09am    
Thanks! That can be very useful to me:)
thank u very much, i gonna try this immediately
OdeJong 21-May-12 9:46am    
I have tried this solution..
I think I need some more code to complete this.. so it's not working @ the moment, I wil try to use it and look @ the internet once again, thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900