tag:blogger.com,1999:blog-61641955131035037642024-03-13T23:10:22.686-07:00Microsoft Languages - DotNet VB, C#, VB.NetUnknownnoreply@blogger.comBlogger44125tag:blogger.com,1999:blog-6164195513103503764.post-13406435842485275872009-07-22T07:26:00.000-07:002009-07-22T07:36:39.621-07:00Multi Thread In VB.netMulti Threading in VB.Netimports system.threadingDim ThreadObject As ThreadThreadObject = New Thread(AddressOf ClassName.functioname)ThreadObject.Start()_________________________________________________________________The Thread generally does not accept any argument. you can create a constructor of a class and pass the required argument to that constructor.E.g.:ClassObject = New Classname(arg1,Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-55105428942578062622009-05-29T14:08:00.000-07:002009-05-29T14:10:58.394-07:00Convert .vox to .wavmdlconvertvox2wav.Convert(SourceFileName, destinationFileName)_________________________________________________________________Create a moduleModule mdlconvertvox2wav Dim WaveHeader() As Int32 = New Int32() {&H46464952, &HFFFFFFDB, &H45564157, &H20746D66, 16, &H10001, 6000, 12000, &H100002, &H61746164, -1} Dim IndexShift() As Int16 = New Int16() {-1, -1, -1, -1, Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-6164195513103503764.post-87374535119430459272009-05-29T14:00:00.000-07:002009-05-29T14:12:03.053-07:00Text to SpeechStep 1: Add a reference with com object Mocrosoft speech Object LibrarySt2p 2:Import SppechlibCode :Dim voice As New SpVoice___________________________________________________________Read from the FileOpenFileDialog.Filter = "Text Files (*.txt)|*.txt" If OpenFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then Dim fs As New System.IO.FileStream(Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-49357796889003934892009-05-06T09:26:00.004-07:002009-05-19T11:29:09.181-07:00Use of Delegate in c#// Declare the Delegatepublic delegate void Uploaddelegate();// Create the object of DelegateUploaddelegate obj1 = new Uploaddelegate(ABC); public static void ABC() { // Enter the Code to Do }Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-28668029367710905172009-04-30T15:10:00.004-07:002009-05-19T11:29:09.139-07:00Namespaces of .NetSystem: Includes essential classes and base classes for commonly used data types, events, exceptions and so on System.Collections: Includes classes and interfaces that define various collection of objects such as list, queues, Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-82141398474109313802009-04-29T14:04:00.004-07:002009-05-19T11:29:09.226-07:00Extract the icon From Exe______________________ Class Definition_____________________Imports SystemImports System.DrawingImports System.Runtime.InteropServicesPublic Class ClsExtractIcon '===================================================================================== ' Enumerations '===================================================================================== Private Enum SHGFI SmallIconUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-31765085145009578882009-04-29T13:54:00.004-07:002009-05-19T11:29:09.240-07:00Programatically Open DSN Window in VB.NetSystem.Diagnostics.Process.Start("ODBCad32")Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-80344358212444355312009-04-29T13:49:00.004-07:002009-05-19T11:29:09.256-07:00Send SMS in VB.NetFor Sending a SMS you have to purchase the SMS gateway and correspondingly you will get the url for thatExample URL= "http://.xyz/default.aspx/sendSMSusername=???password=???? Dim TempURL As String = URL For Sending a SMS you have to purchase the SMS gateway and correspondingly you will get the url for that________________________Code________________________________ Dim useMsg As Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-16675822609072727792009-04-29T13:39:00.004-07:002009-05-19T11:29:09.279-07:00Check the table whether it exist or notPrivate Function fcheckTable(ByVal sDatabaseName As String, ByVal Tablename As String) As Boolean Try fcheckTable = False Dim sSQL As String = "show tables in " & sDatabaseName objCmd = New OdbcCommand(sSQL, ObjCon) Dim oRS As Odbc.OdbcDataReader = objCmd.ExecuteReader Do While oRS.Read If Trim(UCase(Tablename)) = Trim(Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-6595415214630930342009-04-29T13:37:00.004-07:002009-05-19T11:29:09.306-07:00Get The Tables List From a database Private Sub GetTables(ByVal sDatabaseName As String) Try Dim sSQL As String = "show tables in " & sDatabaseName objCmd = New OdbcCommand(sSQL, ObjCon) 'Cmd = CN.CreateCommand 'Cmd.CommandText = sSQL Dim oRS As Odbc.OdbcDataReader = objCmd.ExecuteReader 'Do While oRS.Read cbotablename.Items.Add(oRS(0))Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-55708747543923377582009-02-18T10:34:00.004-08:002009-05-19T11:29:09.322-07:00Mail Sending in VB.Net*************************************************Class Starts Here_________________________________________Imports System.NetImports System.Net.MailImports System.ConfigurationImports System.Text.RegularExpressionsPublic Class ClsMailSender Public seting As SettingType Private _MMsg As Net.Mail.MailMessage Private _EServer As Net.Mail.SmtpClient Private _Cred As NetworkCredential Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-61964340844135002712009-02-18T10:32:00.004-08:002009-05-19T11:29:09.340-07:00Export a list View to a filePublic Function exportListView(ByVal lvw As ListView, Optional ByVal Mtype As String = "") As System.Text.StringBuilder Dim str As New System.Text.StringBuilder() Dim st As String() = New String(lvw.Columns.Count - 1) {} str.Append(vbTab & vbTab & " Viewer" & vbTab & vbTab & vbTab & vbTab & vbCrLf & vbCrLf & vbCrLf & vbCrLf) For Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-87851682131909968222009-02-18T10:29:00.004-08:002009-05-19T11:29:09.374-07:00Searching in a list viewPrivate Sub Searching(ByVal str As String, ByVal col As Integer, ByVal Lvws As ListView) Dim i As Integer Dim TotalCount As Long = 0 If Val(Lvws.Items.Count) > 0 Then For Each itm As ListViewItem In Lvws.Items For i = 0 To itm.SubItems.Count - 1 If UCase(Trim(itm.SubItems(i).Text)) Like "*" & UCase(Trim(str)) & "*" ThenUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-767544651074117172009-02-18T10:28:00.004-08:002009-05-19T11:29:09.390-07:00Load all the children node of a node of app.configPrivate Sub sloadSearchSetting() Dim ary() As String Dim icount As Integer Dim doc As XmlDocument = loadConfigDocument() Dim cnode As XmlNode Dim KeyName As String Dim KeyValue As String Dim i As Integer Dim XmlDoc As New XmlDocument() XmlDoc.Load(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile) For Each xElement As Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-27866005507010294132009-02-18T10:20:00.004-08:002009-05-19T11:29:09.410-07:00Read and write your custom Tag in app.configImports SystemImports System.XmlImports System.ConfigurationImports System.ReflectionModule ReadandWriteinappconfig Public Function ReadSetting(ByVal key As String) As String Return System.Configuration.ConfigurationSettings.AppSettings(key) End Function Public Sub WriteSetting(ByVal key As String, ByVal value As String, ByVal Settingvalue As String) ' load config document Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-44433019149108464602009-02-18T10:17:00.004-08:002009-05-19T11:29:09.444-07:00How to Create a Web ServiceImports System.WebImports System.Web.ServicesImports System.Web.Services.ProtocolsImports System.IOImports System.DataWebService(Namespace:="http://aaaaa.com/")> _ _ Public Function GetMachineIPAddress() As String Dim strHostName As String = "" Dim strIPAddress As String = "" Dim host As System.Net.IPHostEntry strHostName = System.Net.Dns.GetHostName()Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-72983491050404363612009-02-18T10:12:00.004-08:002009-05-19T11:29:09.459-07:00Make an Exe as startupPublic Sub AutoStartup() Try Dim RegKey As RegistryKey RegKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True) RegKey.SetValue("DBFT Client", Application.ExecutablePath) Catch ex As Exception MakeLog("Putting in Windods Auto Startup " & Application.ExecutablePath, Err.Number, Err.Description)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-57823385971173355652009-02-18T10:08:00.004-08:002009-05-19T11:29:09.474-07:00How To Write an INI FileModule#Region "APICalls" ' standard API declarations for INI access Private Declare Unicode Function WritePrivateProfileString Lib "kernel32" _Alias "WritePrivateProfileStringW" (ByVal lpApplicationName As String, _ByVal lpKeyName As String, ByVal lpString As String, _ByVal lpFileName As String) As Int32 Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" _Alias "Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-3684605515210716772009-02-18T10:06:00.004-08:002009-05-19T11:29:09.490-07:00Read From INI File#Region "APICalls" ' standard API declarations for INI access Private Declare Unicode Function WritePrivateProfileString Lib "kernel32" _Alias "WritePrivateProfileStringW" (ByVal lpApplicationName As String, _ByVal lpKeyName As String, ByVal lpString As String, _ByVal lpFileName As String) As Int32 Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" _Alias "Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-17338018218150919792009-02-03T08:45:00.004-08:002009-05-19T11:29:09.516-07:00List of Available DSNPublic Function fGetDSNList() As String() Dim RegHandle As RegistryKey Dim Reg As RegistryKey = Registry.LocalMachine Dim conRegKey1 As String = "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\" Try RegHandle = Reg.OpenSubKey(conRegKey1) Return RegHandle.GetValueNames Catch err As Exception Msgbox(err.description) End TryUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-37715368679155104832008-12-29T00:38:00.004-08:002009-05-19T11:29:09.553-07:00Show a list View in GroupThis will show the list view GroupDim ObjListItem As ListViewItemDim ObjListViewGroup As ListViewGroupObjListViewGroup = New ListViewGroup("File Name :" & FileName)LvwBills.Groups.Add(ObjListViewGroup)For iCount = 0 To 10 ObjListItem = New ListViewItem(ObjListViewGroup) ObjListItem.SubItems.Add("ABCD" Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-1789914906053983122008-12-26T05:45:00.004-08:002009-05-19T11:29:09.570-07:00File opertation in VB.Netimports system.ioPublic Class Form1 Public Sub MaintainintoFile(Optional ByVal StringtoWrite As String = "Error Not Trapped") Try Dim StartLog As Boolean Dim FName As String Dim LogDirName As String Dim BaseErr As String = "" Dim fs As FileStream Dim fileWrite As StreamWriter Dim dir As String Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-91470432126234401732008-12-26T04:54:00.004-08:002009-05-19T11:29:09.536-07:00Download a File From an URLImports SystemImports System.ConfigurationImports System.Resources ' Resource readersImports System.Net.WebClientImports System.IO Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim flag As Boolean = False Dim name As String = "" Dim number As Integer = 0 Dim FTPC As New Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-9257012034166450082008-12-26T04:53:00.004-08:002009-05-19T11:29:09.586-07:00Get the name and type of column of a table Public sub GetColumns(ByVal sTableName As String, ByVal ListBoxObject As ListView) Dim iCount As Integer Dim ObjListviewItem As ListViewItem Dim sSQL As String = "Select * From " & sTableName & " Where 1 = 2" Dim oCmd As Odbc.OdbcCommand = New OdbcCommand(sSQL, ObjCon) Dim oRS As Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6164195513103503764.post-11705235825864800672008-12-26T04:38:00.004-08:002009-05-19T11:29:09.605-07:00List Of Table Private sub GetTables(ByVal sDatabaseName As String, ByVal ListBoxObject As ListBox) Try Dim sSQL As String = "show tables in " & sDatabaseName Dim oCmd As Odbc.OdbcCommand = ObjCon.CreateCommand oCmd.CommandText = sSQL Dim oRS As Odbc.OdbcDataReader = oCmd.ExecuteReader Do While oRS.ReadUnknownnoreply@blogger.com0