Jump to content
Xtreme .Net Talk

ADO DOT NET

Avatar/Signature
  • Posts

    162
  • Joined

  • Last visited

About ADO DOT NET

  • Birthday 05/22/1979

ADO DOT NET's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, Thank you very much for your help :) So this final code still does not work on XP: Declare Auto Function PathMakeSystemFolder Lib "shlwapi.dll" Alias "PathMakeSystemFolder" (ByVal pszPath As String) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Create Directory If Not My.Computer.FileSystem.DirectoryExists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") Then System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") End If 'Create File Dim FileContent As String = "[.ShellClassInfo]" + vbNewLine + "IconFile=%ProgramFiles%\Company\Product\Program.exe" + vbNewLine + "IconIndex=0" + vbNewLine + "InfoTip=Information collected using our application" If Not My.Computer.FileSystem.FileExists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini") Then My.Computer.FileSystem.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini", FileContent, False) End If PathMakeSystemFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") End Sub :(
  2. Well, thanks :) This code must work now, but it's not :( Declare Auto Function PathMakeSystemFolder Lib "shlwapi.dll" Alias "PathMakeSystemFolder" (ByVal pszPath As String) As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Create Directory If Not My.Computer.FileSystem.DirectoryExists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") Then System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") End If PathMakeSystemFolder(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") 'Create File Dim FileContent As String = "[.ShellClassInfo]" + vbNewLine + "IconFile=%ProgramFiles%\Company\Product\Program.exe" + vbNewLine + "IconIndex=0" + vbNewLine + "InfoTip=Information collected using our application" If Not My.Computer.FileSystem.FileExists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini") Then My.Computer.FileSystem.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini", FileContent, False) End If Dim FileDetail As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini") FileDetail.Attributes = IO.FileAttributes.Hidden + IO.FileAttributes.System End Sub
  3. Hi PlausiblyDamp, Thank you very much for your tip. However, it won't work :( I really don't know what should I do. Even if I use Windows to Customize this folder for me, it will create the same file as me! When Windows creates it, it works! :confused: Please help me :(
  4. Hi everybody :) I wanna create a folder in My Documents, named "My Information" for example! And customize its ICON by placing a "Desktop.ini" file into that. So I wrote this code which works perfect, but I don't know why it does not show the ICON as expected :( 'Create Directory If Not My.Computer.FileSystem.DirectoryExists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") Then System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information") End If 'Create File Dim FileContent As String = "[.ShellClassInfo]" + vbNewLine + "IconFile=%ProgramFiles%\Company\Product\Program.exe" + vbNewLine + "IconIndex=0" + vbNewLine + "InfoTip=Information collected using our application" If Not My.Computer.FileSystem.FileExists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini") Then My.Computer.FileSystem.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini", FileContent, False) End If Dim FileDetail As IO.FileInfo = My.Computer.FileSystem.GetFileInfo(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\My Information\Desktop.ini") FileDetail.Attributes = IO.FileAttributes.Hidden + IO.FileAttributes.System
  5. Hi, I have a single line of code in VB6 which I wanna convert to .NET: Here is my VB6 code: If CDbl(Right(Results, 1)) = 0 Then Rights = 500 I already have converted it and here it is: If Convert.ToDouble(Results.ToString.Substring(Results.ToString.Length - 1, 1)) = 0 Then Rights = 500 Just to make sure if I converted correctly and there is no shorter/better way specially for Right$ function, please let me know if my conversion is OK? Thank you very much.
  6. mmm, English is not my local lang, however "flank speed" is used on virtual things like email? for example is it ok if I say "email sent at flank speed"?:confused: is it also formal or informal?
  7. Hi, I want to convert this function to VB.NET: Private Function FilterFileName(ByVal FileName As String) As String FilterFileName = Empty Dim MyLoop As Integer For MyLoop = 1 To Len(FileName) If Asc(Mid$(FileName, MyLoop, 1)) >= 97 And Asc(Mid$(FileName, MyLoop, 1)) <= 122 Or _ Asc(Mid$(FileName, MyLoop, 1)) >= 65 And Asc(Mid$(FileName, MyLoop, 1)) <= 90 Or _ Asc(Mid$(FileName, MyLoop, 1)) >= 48 And Asc(Mid$(FileName, MyLoop, 1)) <= 57 Or _ Asc(Mid$(FileName, MyLoop, 1)) = 32 Or _ Asc(Mid$(FileName, MyLoop, 1)) = 45 Or _ Asc(Mid$(FileName, MyLoop, 1)) = 95 Then FilterFileName = FilterFileName & Mid$(FileName, MyLoop, 1) End If Next End Function Everything is alright, I just cannot find the new Asc() method in .NET. Each old method has a .NET version, for example InStr instead of Mid$ but where is new method for ASC()? Thanks.
  8. I have an array here: Private AttachName() As String In my code probably I will add something to my array, and possible that I don't! However, how can I finally find out if the AttachName has anything inside or not? If AttachName.Length = Nothing Then ... I get error: 'System.NullReferenceException' What should I do?!
  9. Hi, How can I check how many "/" is in a string, JUST with .net functions? Is there a straight way without looping? Thanks.
  10. Yes, this was the only thing I was thinking of! But, I don't want to download it, it may take time, the file maybe large in size, I just want to check if it exists!:confused:
  11. Hi, I am getting a URI address from user, something like: http://www.domain.com/images/logo.jpg How should I quickly validate the user entry by checking it online to see if the file exists on the remote server or not? Thanks!
  12. Hi, I want to check if my user is admin or not? IF not, give him a nice error and End my application! I only need to run this in Windows XP, Vista and Server 2003 ! I have these 2 codes: CODE 1: If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then End End If CODE 2: Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent()) If wp.IsInRole(WindowsBuiltInRole.Administrator) = False Then End End If I just wanna know which one is correct and better to use for me? What's the different between these two? Thank you.
  13. Hi, In VS.NET 2008, in project properties window, a new button added named "View UAC Settings". If I set it to: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 1. Then my application will run in Vista ONLY as admin mode with full privileges? 2. So I won't need to internally check in my application if user is admin and warn/close? 3. This only works for Vista? Or XP also? Thanks
  14. Pleaseee! Help me! :( That code works fine, but returns: C:\Documents and Settings\User\Local Settings\Application Data - I wanna get: C:\Documents and Settings\User\Application Data - So I changed: CSIDL_LOCAL_APPDATA to: CSIDL_APPDATA But I get error: CSIDL_APPDATA : Variable not found! Why this occurs?:(
  15. Hi, Thanks for your help. However, I am working in VB6. This will work even in Windows 98 and ME? Thanks.
×
×
  • Create New...