Jump to content
Xtreme .Net Talk

usvpn

Avatar/Signature
  • Posts

    48
  • Joined

  • Last visited

Everything posted by usvpn

  1. Hi, I just have an English question because my En is not good. One form in my application needs to run as admin, while my whole application does not! However, when user wants to open that form and application is not run as admin I want to show user a message: Application is invoker while SystemToolsMenu needs administrator rights. Do you want to run it anyway? Anyone can help me make the above sentence better? Thanks :)
  2. Howdy, I want my application to run only on Win7: Dim MyVersion As Version = Environment.OSVersion.Version Dim SevenVersion As New Version(6, 1, 0, 0) If Not Version.op_GreaterThanOrEqual(MyVersion, SevenVersion) Then End Above code will allow to run on 7 or later, how to change the condition to run only on 7? Thanks.
  3. Hi, Using WebClient due to strict content filtering some times I cannot open an HTTPS address, but I can open the same HTTP address will open. So I want to try the HTTPS first, and if fails then try the HTTP, if it also fails then return the error. Dim WebClient As New System.Net.WebClient Dim NewString As String = WebClient.DownloadString("https://www.domain.com/file.txt") WebClient.Dispose() What's the best algorithm? I can try HTTPS and then try HTTP in CATCH or I can try each one in a separate TRY/CATCH and then evaluate their values or what? Thanks.
  4. Hi, I am using .NET Framework 4.0 and want to do a task. I have a .zip file with a folder named "word" in the root and a file named "document.xml" in the folder! I want to unzip the <ZIP File>\word\document.xml on the fly and store the whole contents of document.xml in a string! I will need a function like this: Private Function GetContents(ByVal FileName) As String FileName is the name of source zip file and contents are stored as output! I need a VB.NET code snippet, anyone can help me here? Thanks :)
  5. Please help, I'm driving crazy! This is the most strange thing I ever seen in .NET! I cannot find what's the problem and how to solve it! Private Sub SendFAXForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Select Case RememberCheckBoxX.Checked Case False Try Dim MyConnection As New OleDbConnection(EmailDBString) MyConnection.Open() Dim MyCommands As New OleDbCommand("DELETE * FROM SendFAX", MyConnection) Dim MyReader As OleDbDataReader = MyCommands.ExecuteReader MyReader.Close() MyConnection.Close() Me.Close() Catch Exception As Exception MessageBoxEx.Show("There is an error resetting data in database." + vbNewLine + Exception.Message, My.Application.Info.AssemblyName, MessageBoxButtons.OK, MessageBoxIcon.Warning) End Try End Select End Sub It calls itself again & again!
  6. snarfblam thanks, yes Form_Closing is not a good idea...
  7. Thanks man, this code is inside the Form_Closing event...
  8. I am newbie too, ah man, even you know what infinite recursion is, so I must be so stupid! I couldn't understand what did you mean by your post? Remind me to use Google rather than posting here? OK, I'll remember that! I really use the same code somewhere else and it works!
  9. Hi, I use Microsoft Access Database Engine 2010 and my code which I already used it somewhere else throws an error I can't understand! Can anybody help me as it's just a few lines and snapshots are attached? Thanks.
  10. This is a long and complicated process to make a 100% accurate regular expression to validate email address, but, I have a good one with 2 bugs, it reports the following valid email addresses as invalid: user@domain.museum (6 letter domain which is only museum?!) user@1domain.com (domain cannot start with numbers!) Since I am not familiar with regular expressions I want to know if anyone knows how to fix this 2 bugs? Please explain each of them separately so in case I don't want to use the 1st fix I can! Dim AddressPattern As String = _ "^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@" & _ "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?" & _ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\." & _ "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?" & _ "[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|" & _ "([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$"
  11. -----
  12. Yes, but for email client is a little different, email clients usually give so many character sets to users to choose! So I want to know which ones to remove, for example, the character sets which have MAC inside them, are available for Windows? What's the meaning of MAC? For target systems?
  13. I am using an email component, it needs me to set the EmailMessage.CharSet property according to the supported values from this table: http://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.80%29.aspx Like windows-1256 or utf-8... However, I know that not all of them are applicable for my Windows application which only runs on Intel x86 or x64 platforms and only WinXp, Vista, 7 OS. So which ones are applicable for me? For example, some MAC encoding, like x-mac-japanese or x-mac-arabic are for MAC only? Or can be used in Windows too? Or also for UTF-32, it always returns System.NotSupportedException
  14. Good morning, I need to pass the Charset Encoding name which is defined in the 2nd column of the below table: http://msdn.microsoft.com/en-us/library/system.text.encoding%28v=vs.80%29.aspx Like windows-1256 or utf-8... However, I know that not all of them are applicable for my Windows application which only runs on Intel x86 or x64 platforms and only WinXp, Vista, 7 OS. So which ones are applicable for me? For example, some MAC encoding, like x-mac-japanese or x-mac-arabic are for MAC only? Or can be used in Windows too? Or also for UTF-32, it always returns System.NotSupportedException
  15. Hi, I have a text file on a remote server with this content: - Line1 Line2 Line3 ... - I use this code to download it and put each line in a string (array) Dim WebClient As New System.Net.WebClient WebClient.Encoding = System.Text.Encoding.ASCII WebClient.CachePolicy = New System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore) Dim NewString As String = WebClient.DownloadString("http://www.domain.com/file.txt") WebClient.Dispose() Dim MyArray() As String = NewString.Split(vbNewLine) For MyLoop As Integer = 0 To MyArray.Length - 1 MsgBox(MyArray(MyLoop).ToString.Replace(vbNewLine, "")) Next It's OK, but when showing each line, the 1st line is OK. After 2nd line, it applies a vbNewLine/vbCrLf to the beginning of each line. And I CANNOT remove that, even with .Replace(vbNewLine, "") How to remove this vbNewLine/vbCrLf from beginning of each line? Thanks.
  16. Hi, I want to create a registry string : HKEY_CURRENT_USER\Software\Nico Mak Computing\WinZip\WinZip And set the value of "0" to it. So the shortest way is: Dim ExtractKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\Nico Mak Computing\WinZip\WinZip") ExtractKey.SetValue("OpnExplFolder", "0") ExtractKey.Close() ? I'm doing it good and is there a shorter way? And .Close is necessary? Thank you very much...
  17. Hi, Anyone can help me with converting a regular path like: C:\Program Files\Steinberg\Cubase 6\MP3.jpg to a web relative path like: ../../../Program%20Files/Steinberg/Cubase%206/MP3.jpg To use in HTML files? Thank you.
  18. Hi everyone, I still have one more problem getting total/available virtual memory, maybe I'm doing something wrong and just wanted to know your professional comments :) Select Case My.Computer.Info.TotalVirtualMemory Case Is >= 1073741824 GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory / 1073741824, 0) + " GB" + vbNewLine Case 1048576 To 1073741823 GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory / 1048576, 0) + " MB" + vbNewLine Case 1024 To 1048575 GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory / 1024, 0) + " KB" + vbNewLine Case 0 To 1023 GetRAMInfo += FormatNumber(My.Computer.Info.TotalVirtualMemory, 0) + " Bytes" + vbNewLine Case Else GetRAMInfo += "N/A" + vbNewLine End Select It's always wrong! For example, now Windows System Information returns: Total Virtual Memory = 15.8 GB Available Virtual Memory = 5.52 GB While the above code returns: Virtual Memory: 8,191 GB free of 8,192 GB (I also use the same above code for My.Computer.Info.AvailableVirtualMemory) Thanks :)
  19. Hi, Since I sign my project .exe files with my code signing certificate, I want to check in my application MainForm_Load if the executable is signed and the signature is valid? If not signed or signature has been tampered it must exit the code. So what do you think guys about this? How can I check this? Thank you :)
  20. Hi, I create some custom button items in code. I need to have some code for their Button_Click event and set Button.Checked = Not Button.Checked So I use this code: AddHandler MyAccount1Button.Click, AddressOf SubAccountButtonItem AddHandler MyAccount2Button.Click, AddressOf SubAccountButtonItem ... Private Sub SubAccountButtonItem(ByVal sender As Object, ByVal e As System.EventArgs) 'How to set every Button clicked to not to clicked? 'Button.Checked = Not Button.Checked End Sub
  21. Deleted Deleted
  22. Hi, I need to disable the form's context menu, when you right click on a form's caption bar a context menu appear. Please see my snapshot. How to do that in VB.NET? Thank you.
  23. See also, XVBT Hi, I use: Dim MyArray() As String = = EmailMessage.GetHeaderField("Disposition-Notification-To") EmailMessage is a 3rd party component, now it may or may not have anything, so the array is null/nothing in that case. In that case, any operation on array will return System.NullReferenceException Even if I want to check if the array : If MyArray IsNot Nothing or If MyArray.Length = 0 All will result in System.NullReferenceException How to check such an array at all? Thanks.
  24. Just a general question: I prevent user from getting System directories so he cannot select them. But aside System directories, what other directories I should prevent from listing? For example, my application runs as Invoker, of course! Now if a directory has denied user from accessing (Properties/Security Tab in Windows 7) that directory also must not be listed.
  25. Hi, I get the directories like this: Dim DriveInfo As New DirectoryInfo("C:\") Dim DirInfo As DirectoryInfo() = DriveInfo.GetDirectories However, it returns all directories even system hidden ones. It seems that this just follows what I set in Windows for file and folder browsing, since I set the Windows to show all files, I think it's also showing all folders to me, I am not sure however. I just want NOT to get the system directories like Recycle Bin and System Volume Information, how to do that? Thank you.
×
×
  • Create New...