Storing and retrieving information from the Windows Registry will play a major part in any programmer's life. You can store small bits of information, such as recently used files, form sizes and location, and user preferences—to name just a few—in the Windows Registry. My aim with this article is to explain the major differences between the way Visual Basic 6 and Visual Basic.NET utilise the Windows Registry. Visual Basic 6 and the Windows Registry Visual Basic 6 comes with four procedures for accessing the Windows Registry:. SaveSetting The SaveSetting statement is used to store a value in the Registry. Example SaveSetting('Registry Example', 'Form Location', 'Left', 200) GetSetting Example Dim strLeft As String 'Variable to hold value returned from 'Registry 'Read Left value stored strLeft = GetSetting('Registry Example', 'Form Location', 'Left') GetAllSettings Example ' Object to hold 2-dimensional array returned by GetAllSettings. Dim arrSettings(,) As String ' Retrieve the settings.
List all files in a folder with VB.NET In.NET you can use the DirectoryInfo class of the System.IO namespace to get a list of files in a particular folder. DirectoryInfo has a GetFiles method that returns a file list, as FileInfo structures, from the specified directory. To list all files and folders in a specific FTP folder just us ChangeFolder and GetList methods: [csharp] // C# version using (Ftp client = new Ftp()) { client. About us « Get file or folder info using FTP. Move file to different folder using FTP » List folders using FTP. To list all files and folders in a specific FTP folder just us.
ArrSettings = GetAllSettings('Registry Example', 'Form Location') txtGetAllSettings.Text = arrSettings(0, 0) & ' = ' & arrSettings(0, 1) & vbCrLf 'left txtGetAllSettings.Text = txtGetAllSettings.Text & arrSettings(1, 0) & ' = ' & arrSettings(1, 1) 'top DeleteSetting Example DeleteSetting('Registry Example') As you probably noticed, there virtually is not much difference in the Visual Basic 6 and Visual Basic.NET functions. The only minor difference was with the Multidimensional array declaration; besides that, everything still is the same. Visual Basic.NET introduces two new intrinsic Registry functions, namely UserAppDataRegistry and CommonAppDataRegistry.SetValue, that also store and retrieve values in the Registry. Take a closer look at these.
This working fine for upload file on FTP. ' set up request. Dim clsRequest As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create('ftp://ftp.myserver.com/test.txt'), System.Net.FtpWebRequest) clsRequest.Credentials = New System.Net.NetworkCredential('myusername', 'mypassword') clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile ' read in file. Dim bFile As Byte = System.IO.File.ReadAllBytes('C: Temp test.txt') ' upload file. Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream clsStream.Write(bFile, 0, bFile.Length) clsStream.Close clsStream.Dispose Thanks.