
SIMIN
Avatar/Signature-
Posts
92 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by SIMIN
-
Resolved Resolved :)
-
Thanks all, Yes, ContactID is a GUID, and it worked perfectly :)
-
Hi, Here is what I do to generate this ID: http://www.xtremedotnettalk.com/showthread.php?t=101780 Do you think I can use System.Guid.NewGuid.ToString() to generate these IDs? I never heard of System.Guid.NewGuid.ToString() until now.
-
Hi, I was sure I am writing the output file in the correct format, and I was right. However, I found the only problem is with my random generated IDs. It seems that I really cannot generate random alphanumeric IDs on the fly and use it in the .contact files. But how can I find how they generate these random IDs? :confused:
-
Hi everyone:) As you know, from Windows Vista, user contacts are not stored in .wab files anymore... However, they are stored here: X:\Users\Your User Name\Contacts I want to CREATE / GENERATE contacts programatically and save them here in the same format. This format is very simple and is user readable. For example, this sample: <?xml version="1.0" encoding="UTF-8"?> <c:contact c:Version="1" xmlns:c="http://schemas.microsoft.com/Contact" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MSP2P="http://schemas.microsoft.com/Contact/Extended/MSP2P"> <c:CreationDate>2009-01-19T20:16:08Z</c:CreationDate><c:Extended xsi:nil="true"/> <c:ContactIDCollection><c:ContactID c:ElementID="7a122ea4-c7c5-4eb3-855e-39c97dc46a54"><c:Value>a18452d7-bc26-467d-8a5c-527d2c70ba8b</c:Value></c:ContactID></c:ContactIDCollection><c:EmailAddressCollection><c:EmailAddress c:ElementID="0e59a008-481c-4c99-b3cc-c85c89d616ff"><c:Type>SMTP</c:Type><c:Address>user@domain.com</c:Address><c:LabelCollection><c:Label>Preferred</c:Label></c:LabelCollection></c:EmailAddress><c:EmailAddress c:ElementID="280c131c-a5ad-41ca-acc2-aff9030c76a2" xsi:nil="true"/></c:EmailAddressCollection><c:NameCollection><c:Name c:ElementID="e8afd09a-9406-4e42-bad1-b4148ade040e"><c:FormattedName>user@domain.com</c:FormattedName></c:Name></c:NameCollection><c:PhotoCollection><c:Photo c:ElementID="834fd30a-de94-4558-b650-d3d8c3e1fcd9"><c:LabelCollection><c:Label>UserTile</c:Label></c:LabelCollection></c:Photo></c:PhotoCollection></c:contact> So, when I want to generate and save a contact here, I simply just change the email address and re-generate random IDs and save it as a .contact file in this location: Dim OutputString As String = Nothing OutputString = "<?xml version=""1.0"" encoding=""UTF-8""?>" + vbNewLine OutputString = OutputString + "<c:contact c:Version=""1"" xmlns:c=""http://schemas.microsoft.com/Contact"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:MSP2P=""http://schemas.microsoft.com/Contact/Extended/MSP2P"">" + vbNewLine OutputString = OutputString + vbTab + "<c:CreationDate>" + Now.ToString("yyyy-MM-dd") + "T" + Now.ToString("HH:mm:ss") + "Z</c:CreationDate><c:Extended xsi:nil=""true""/>" + vbNewLine OutputString = OutputString + vbTab + "<c:ContactIDCollection><c:ContactID c:ElementID=""" + GenerateContactID() + """><c:Value>" + GenerateContactID() + "</c:Value></c:ContactID></c:ContactIDCollection><c:EmailAddressCollection><c:EmailAddress c:ElementID=""" + GenerateContactID() + """><c:Type>SMTP</c:Type><c:Address>" + MyReaders("Email").ToString + "</c:Address><c:LabelCollection><c:Label>Preferred</c:Label></c:LabelCollection></c:EmailAddress><c:EmailAddress c:ElementID=""" + GenerateContactID() + """ xsi:nil=""true""/></c:EmailAddressCollection><c:NameCollection><c:Name c:ElementID=""" + GenerateContactID() + """><c:FormattedName>" + MyReaders("Email").ToString + "</c:FormattedName></c:Name></c:NameCollection><c:PhotoCollection><c:Photo c:ElementID=""" + GenerateContactID() + """><c:LabelCollection><c:Label>UserTile</c:Label></c:LabelCollection></c:Photo></c:PhotoCollection></c:contact>" + vbNewLine My.Computer.FileSystem.WriteAllText(WABPath + "\" + MyReaders("Email").ToString + ".contact", OutputString, False) However, although the final file contents will be exactly in the same format, but Windows will not recognize my created files as contacts!!! This is strange, I am sure they are in the same format!!! Anyone knows why this happens?! :confused: Thank you...
-
Hi, I wanna generate a random alphanumeric in the following format: d4g2o5m3-u1q2-s7z9-z6o8-o3q2c2m5m2s9 So with your help, I wrote a public function like this: Public Function GenerateContactID() As String Dim MyRandom As New Random GenerateContactID = Nothing For MyLoop As Integer = 1 To 8 If MyLoop Mod 2 = 1 Then GenerateContactID = GenerateContactID + Convert.ToChar(MyRandom.Next(97, 123)) End If If MyLoop Mod 2 = 0 Then GenerateContactID = GenerateContactID + MyRandom.Next(1, 10).ToString End If Next GenerateContactID = GenerateContactID + "-" For MyLoop As Integer = 1 To 4 If MyLoop Mod 2 = 1 Then GenerateContactID = GenerateContactID + Convert.ToChar(MyRandom.Next(97, 123)) End If If MyLoop Mod 2 = 0 Then GenerateContactID = GenerateContactID + MyRandom.Next(1, 10).ToString End If Next GenerateContactID = GenerateContactID + "-" For MyLoop As Integer = 1 To 4 If MyLoop Mod 2 = 1 Then GenerateContactID = GenerateContactID + Convert.ToChar(MyRandom.Next(97, 123)) End If If MyLoop Mod 2 = 0 Then GenerateContactID = GenerateContactID + MyRandom.Next(1, 10).ToString End If Next GenerateContactID = GenerateContactID + "-" For MyLoop As Integer = 1 To 4 If MyLoop Mod 2 = 1 Then GenerateContactID = GenerateContactID + Convert.ToChar(MyRandom.Next(97, 123)) End If If MyLoop Mod 2 = 0 Then GenerateContactID = GenerateContactID + MyRandom.Next(1, 10).ToString End If Next GenerateContactID = GenerateContactID + "-" For MyLoop As Integer = 1 To 12 If MyLoop Mod 2 = 1 Then GenerateContactID = GenerateContactID + Convert.ToChar(MyRandom.Next(97, 123)) End If If MyLoop Mod 2 = 0 Then GenerateContactID = GenerateContactID + MyRandom.Next(1, 10).ToString End If Next End Function However, sometimes the call to this function will return the same result, I mean it's not completely random? How that's possible? Thank you :)
-
Private ReportLog As StringBuilder Private Sub DoThat() 'We didn't assign any value to the ReportLog so here we want to check if it's empty or not? If ReportLog IsNot Nothing And ReportLog.Length > 0 Then ' End IF End Sub The problem is that "If ReportLog IsNot Nothing And ReportLog.Length > 0 Then" itself throws an exception! A first chance exception of type 'System.NullReferenceException' occurred in MyApp.exe A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll How should I check that variable? Thank you :)
-
The build number of Vista SP1 is the same as Windows Server 2008 and that makes the problem!
-
How do you people get this special folder? D:\Users\My User Name\ I tried to get all special folders but was not able to get this one in Vista! :( IS that possible or I cannot find it? Thanks.
-
Hi everyone, How can I detect if my current OS which my program is running under, is Windows Vista? Please note that there are 2 versions of Vista: Vista and Vista SP1. The build number of Vista SP1 is the same as Windows Server 2008 and that makes the problem! I just want to make sure my OS is vista?! Please help me :) Thanks all...
-
Hi and thanks :) you are so kind I just replaced it in my code and it's working, I think so :) sorry but for final confirm we can say that these 2 codes are the same now? code1: Private Function StripNullChars(ByVal MyString As String) As String Do While Len(MyString) > 0 If Asc(VB.Right(MyString, 1)) <> 0 Then Exit Do MyString = VB.Left(MyString, Len(MyString) - 1) Loop StripNullChars = MyString End Function code2: Private Function StripNullChars(ByVal MyString As String) As String StripNullChars = MyString.Trim(Convert.ToChar(0)) End Function
-
hi thanks and many thanks for all your valuable helps :) I am a little bit confused so my final converted code would be: Private Function StripNullChars(ByVal MyString As String) As String StripNullChars = MyString.Trim(vbNull) End Function you mean? but it has error thanks again :)
-
Hi, I want to convert this VB6 code to VB.NET: Private Function StripNullChars(ByVal MyString As String) As String Do While Len(MyString) > 0 If Asc(VB.Right(MyString, 1)) <> 0 Then Exit Do MyString = VB.Left(MyString, Len(MyString) - 1) Loop StripNullChars = MyString End Function However, I don't know what are replacements .NET version of VB.Left and VB.Right? Please help me. Thanks.
-
Hi eveyone. I would like to read a binary file: Windows Address Book. However, since I JUST want to import email addresses from WAB to my application I think I can open and read it myself. If you see my snapshot, email addresses are human readable and just with spaces, not encoded! So I think this command will open file file well: Dim ReadText As Byte() = System.IO.File.ReadAllBytes("C:\Documents and Settings\Username\Application Data\Microsoft\Address Book\Username.wab") The only problem is that I never tried to read binary files. And don't know how to process this Byte variable: ReadText! Do you have any idea how can I just extract email addresses? I even have regex code to do it, but don't know how to process ReadText? Please help me :(
-
Hi everyone, Happy New Year! :D I have a question, anyone tried to read Windows Address Book (WAB) file via his VB program? In XP, it is usually located in: C:\Documents and Settings\Username\Application Data\Microsoft\Address Book It is named "Username.wab" and I want to read it and import its contacts to my own contact manager program! Please help me if you can :)
-
Hi, I have a DateTimePicker control that returns the current date. My usage is like this: DateTimeInput.Value.ToString("MMMM dd, yyyy") Please note that I need to get the date in the specified format. I just don't know how to add 1~2 years to the date. I mean if user selected January 01, 2009, I want to get January 01, 2010. So how can I add just 1 year or 2 years to the year of returned value? Thank you guys :)
-
Hi, I have set the "Make single instance application" check box. And when my application version is 1.0.0.0 for example, it is OK and won't load multiple instances. But when I create a new version, for example 1.0.0.1, then I can run 2 instances of my application, when the 1st instance is 1.0.0.0 and the second instance is 1.0.0.1... What should I do to prevent this? I don't want multiple instances at all... Thanks :)
-
Hi, First, please excuse me for my poor English! Around 1 year ago, I was browsing the CIA website http://www.cia.gov. I found an article which I enjoyed it a lot. It was something about first spy man of the US which was executed by British army, I think. It was a real story of a man who was spying for the US and later, when British army caought him, before they kill him, he said one favor sentence: Something like: "I am so sorry that I just have one life to give for my country". Unfortunately, I don't remember the exact sentence, but I wanna have it and know his name so I can search Google and find his story and read it again. I really love it :) Anyone can help me? Thanks.
-
Hi, I have 2 questions about ListView in vb6? 1. Is there a way to design the columns of ListView at design-time rather than run-time? However, I am adding columns in code this way: ListView1.ColumnHeaders.Add , , "Item 1", 600 2. How can I lock the header of ListView from being resized? I mean I don't want columns to be resized? Thank you :)
-
Hi, I have an ImageList and load some pictures with the following names for example: uk.gif us.gif uy.gif uz.gif va.gif And so forth... I can see the name of each icon in the Images Collection Editor, but not from code. My question is that how can I get the image NOT BY INDEX but by the name of internal image? For example get the image from ImageList by "us.gif"? Thanks.
-
Sorry about misleading subject, I've edited my post! I want to know what's the replacement for WebClient in VB6? What should I do in VB6? Dim MyClient As WebClient = New WebClient Dim MyData As Stream = Nothing Dim MyReader As StreamReader = Nothing Dim MyResponse As String = Nothing MyData = MyClient.OpenRead(MyString) MyReader = New StreamReader(MyData) MsgBox MyReader.ReadToEnd() I need to something like this in VB6?
-
Hello again, :) You are great :) Thank you, I've learned a lot from you. Just one think I cannot find out is that in my real data: <?xml version="1.0" encoding="utf-16" ?> <MessageAccount> <Account_Name type="SZ">my account #1</Account_Name> <Connection_Type type="DWORD">00000003</Connection_Type> <POP3_Server type="SZ">pop.domain.com</POP3_Server> <POP3_User_Name type="SZ">info</POP3_User_Name> <POP3_Password2 type="BINARY">gfdjkgdfghdfjkghdfgjk</POP3_Password2> <POP3_Use_Sicily type="DWORD">00000000</POP3_Use_Sicily> <POP3_Prompt_for_Password type="DWORD">00000000</POP3_Prompt_for_Password> <SMTP_Server type="SZ">smtp.domain.com</SMTP_Server> <SMTP_Display_Name type="SZ">My Name</SMTP_Display_Name> <SMTP_Email_Address type="SZ">info@domain.com</SMTP_Email_Address> </MessageAccount> Some fields are type="SZ", or string. While some others are in this format: <SMTP_Port type="DWORD">00000019</SMTP_Port> I am not sure how is this. But I think it's in Hexadecimal format?!!! :confused: Which I should convert to Decimal format to get the real value? In this sample, SMTP port is definitely 25! Do you have any idea how can I do this ? :) Thank you again for your help. :p
-
Thank you Diesel, It was a great help and will work on it to see what you have done, so I learn it :p Anyway, just one question about your code: You have While reader.Read() . So is it necessary to have reader.Read() Before End While?
-
Hello and thank you very much for helping me :) As a matter of fact, I already red that article (I use .NET Framework 2) I also played around with all these for around 24 hours! But could not find how to read it like this: If this is our row: <Account_Name type="SZ">my account #1</Account_Name> I wanna get the value of Account_Name, which is my account #1 How this can be done? :) Thank you
-
hello all, This is my first time I wanna read from a XML file! I have a XML file like this: <?xml version="1.0" encoding="utf-16" ?> <MessageAccount> <Account_Name type="SZ">my account #1</Account_Name> <Connection_Type type="DWORD">00000003</Connection_Type> <POP3_Server type="SZ">pop.domain.com</POP3_Server> <POP3_User_Name type="SZ">info</POP3_User_Name> <POP3_Password2 type="BINARY">gfdjkgdfghdfjkghdfgjk</POP3_Password2> <POP3_Use_Sicily type="DWORD">00000000</POP3_Use_Sicily> <POP3_Prompt_for_Password type="DWORD">00000000</POP3_Prompt_for_Password> <SMTP_Server type="SZ">smtp.domain.com</SMTP_Server> <SMTP_Display_Name type="SZ">My Name</SMTP_Display_Name> <SMTP_Email_Address type="SZ">info@domain.com</SMTP_Email_Address> </MessageAccount> Well, I know I should use XMLReader for this: Dim reader As XmlTextReader = New XmlTextReader (URLString) Also, I know I can read it in a loop: Do While (reader.Read()) Console.WriteLine(reader.Name) Loop But the data are returned in a strange sort! Even if I split the reader.NodeType. However, I am new to this. I just wanna pass the TEXT and get the VALUE. And don't know how. Please help me. For example in this XML file: <Account_Name type="SZ">my account #1</Account_Name> I wanna pass Account_Name and get my account #1. ... I searched and worked a lot but could not find it. Please help me, Thank you.