tag:blogger.com,1999:blog-33713819041884959992024-02-06T20:45:54.427-08:00Sample Code in VB6Saihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-3371381904188495999.post-68059225572847959132008-10-20T23:12:00.000-07:002008-10-20T23:14:07.009-07:00Sorting in ListView VB6I have 2 line of codes in sorting a listview.<br /><br /><br />Try to add this codes to your listview_columnclick<br /><br />listview1.sortkey = columnheader.index - 1<br />lstview1.sorted = trueSaihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-64889052876574750312008-08-31T19:49:00.000-07:002008-08-31T20:02:11.785-07:00Populate ListView from SQL ServerHello to all.<br /><br />Today my sample is all above listview. Populate listview of data from database.<br /><br />If you have ur connectionstring and recordset. Then set 1 listview and 1 commandbutton.<br /><br />In your command button insert this code:<br /><br />Dim Item as ListItem 'variable for your subitems<br /><br />ListView1.ListItems.Clear 'Clear your Listview before loading a new data<br /><br />While Not rs.eof<br /><br />Set Item = ListView1.ListItems.Add(,,rs!One)<br />Item.Subitems(1) = rs!Two<br />rs.movenext<br /><br />Wend<br /><br />Hope this one will help youSaihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com2tag:blogger.com,1999:blog-3371381904188495999.post-15414342024199327442008-08-21T19:34:00.000-07:002008-08-21T19:41:01.476-07:00Numeric only in TextboxI have function code here. To restrict the input in textbox only for numeric.<br /><br />Public Function OnlyNumericKeys(KeyAscii As Integer, TextBox As control) As Integer<br /><br />Select Case KeyAscii<br /> Case 8, 48 To 57, 46 And InStr(TextBox, ".") = 0<br /> Case 45 And InStr(TextBox, "-") = 0<br /><br /> If TextBox.SelStart > 0 Then <br /> KeyAscii = 0 <br /> End If <br /> Case Else<br /><br /> KeyAscii = 0<br /><br /> End Select <br /> OnlyNumericKeys = KeyAscii<br /><br />End Function<br /><br /><br />Thanks for the help of my friend (mike).Saihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-89971783565596577902008-08-21T19:30:00.000-07:002008-08-21T19:33:13.993-07:00Removing Maximize ButtonHello there.<br /><br />This API Codes will help you to remove the maximize button in form.<br /><br />Public Declare Function GetWindowLong Lib "user32" Alias _ <br />"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long<br /><br />Public Declare Function SetWindowLong Lib "user32" Alias _<br />"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _<br />ByVal dwNewLong As Long) As Long<br /><br />Public Const GWL_STYLE = (-16)<br />Public Const WS_MAXIMIZEBOX = &H10000<br />Public Const WS_MINIMIZEBOX = &H20000<br /><br />Hope this one can help.Saihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-90147632378509360642008-08-21T19:25:00.000-07:002008-08-21T19:29:01.653-07:00How to Center a FormTry this code. Hope it can help.<br /><br />In your module copy then paste this code:<br /><br />Public Sub CenterForm(f As Form, w)<br />f.Left = (w.ScaleWidth - f.Width) / 2<br />f.Top = (w.ScaleHeight - f.Height) / 2<br />End Sub<br /><br />In your Form Load:<br /><br />Private Sub Form_Load()<br />CenterForm Me, Main<br />End Sub<br /><br />This code will centering your form in mdiparentSaihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-42457317098170767952008-08-21T19:20:00.000-07:002008-08-21T19:25:42.333-07:00User System LoginHi.<br /><br />Sample code in System Login. And theres a 3 attempt to log.<br /><br />Set rs = BASACONN(connstr, "select * from usersettings where username=txtuser and password=txtpassword")<br /><br />If rs.EOF Then<br /> MsgBox "Invalid Username/Password. Please Try again", vbExclamation, "Invalid"txtusername.SetFocus<br /> txtcount.Text = Val(txtcount.Text) + 1<br /><br /> '''wrong password<br /> If Val(txtcount.Text) > 2 Then<br /> MsgBox "You have 3 Invalid Input of Username/Password. This Program will terminate",vbCritical, "Exit Program"<br /> End<br /> End If<br /> ''end<br /><br />Else<br /><br /> Unload Me<br /> Main.Show<br /><br />EndifSaihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-73020769042256414632008-06-16T21:54:00.000-07:002008-06-16T22:46:42.903-07:00How to use Drivelistbox, Dirlistbox and FilelistboxGood Day to my visitor. This sample codes all about Drivelistbox, Dirlistbox and Filelistbox. In this example you will learn on how to use these 3 basic controls in Visual Basic 6.<br /><br /><br /><br /><br />First Step: Create new project in Visual Basic 6. Then Input a Controls in Form1.<br /> *label1, filename , Drivelistbox, Dirlistbox, and Filelistbox.<br /><br /><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF7ZANsnBzCK3YtB0fRzKFr3798ybJBV8VUc1YvXVrfa8dzGVm_lpebEc-HCjFS0bl5oUIAVvDbitO4r3NgM9Z3TKJ-f3fPMpmpmy__4Ahm2qmWkoPumwJQWrn3emjYhD482l3UGXDO-oV/s1600-h/filebrowser.bmp"><img id="BLOGGER_PHOTO_ID_5212721118116150786" style="CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF7ZANsnBzCK3YtB0fRzKFr3798ybJBV8VUc1YvXVrfa8dzGVm_lpebEc-HCjFS0bl5oUIAVvDbitO4r3NgM9Z3TKJ-f3fPMpmpmy__4Ahm2qmWkoPumwJQWrn3emjYhD482l3UGXDO-oV/s320/filebrowser.bmp" border="0" /></a><br /><br />Second Step: Write these following codes.<br /><br />Private Sub DirListBox_Change()<br />FileListBox.Path = DirListBox.Path<br />End Sub<br /><br />Private Sub FileListBox_Click()<br />filename.Caption = FileListBox.filename<br />End Sub<br /><br />Private Sub DriveListBox_Change()<br />Dim msg As String<br />Dim result As String<br /><br />On Error GoTo Error<br />DirListBox.Path = DriveListBox.Drive<br />Exit Sub<br />Error:msg = "Error: " & Err.Number & ": " & Err.Description<br />result = MsgBox(msg, vbOKCancel + vbExclamation , "No Data")<br /><br /> If result = vbOK Then<br /> Resume<br /> Else<br /> DriveListBox.Drive = DirListBox.Path<br /> Err.Clear<br /> Exit Sub<br /> End If<br />End SubSaihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-85843149636135829352008-05-14T23:46:00.000-07:002008-05-14T23:49:54.844-07:00How to Clear all Text in a TextBoxFirst create a variable:<br />Dim Sayre As Control<br /><br />Then Type this code in a Button:<br />For Each sayre In Me<br />If TypeOf sayre Is TextBox Then<br />sayre.Text = ""<br />End If<br />Next<br />####################################<br />Private Sub Command1_Click()<br />Dim sayre As Control<br /><br />For Each sayre In Me<br />If TypeOf sayre Is TextBox Then<br />sayre.Text = ""<br />End If<br />Next<br />End Sub<br />####################################Saihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0tag:blogger.com,1999:blog-3371381904188495999.post-12893505903852753272008-04-10T18:56:00.000-07:002008-04-10T19:00:20.522-07:00Visual Basic 6.0<div align="justify"><span style="font-size:85%;">Visual Basic (VB) is a </span><a title="Third-generation programming language" href="http://en.wikipedia.org/wiki/Third-generation_programming_language"><span style="font-size:85%;">third-generation</span></a><span style="font-size:85%;"> </span><a class="mw-redirect" title="Event driven programming language" href="http://en.wikipedia.org/wiki/Event_driven_programming_language"><span style="font-size:85%;">event driven programming language</span></a><span style="font-size:85%;"> and associated </span><a title="Integrated development environment" href="http://en.wikipedia.org/wiki/Integrated_development_environment"><span style="font-size:85%;">development environment</span></a><span style="font-size:85%;"> from </span><a title="Microsoft" href="http://en.wikipedia.org/wiki/Microsoft"><span style="font-size:85%;">Microsoft</span></a><span style="font-size:85%;"> for its </span><a title="Component Object Model" href="http://en.wikipedia.org/wiki/Component_Object_Model"><span style="font-size:85%;">COM</span></a><span style="font-size:85%;"> programming model.</span><a title="" href="http://en.wikipedia.org/wiki/Visual_Basic#cite_note-0"><span style="font-size:85%;">[1]</span></a><span style="font-size:85%;"> Visual Basic was derived from </span><a class="mw-redirect" title="BASIC programming language" href="http://en.wikipedia.org/wiki/BASIC_programming_language"><span style="font-size:85%;">BASIC</span></a><span style="font-size:85%;"> and enables the </span><a title="Rapid application development" href="http://en.wikipedia.org/wiki/Rapid_application_development"><span style="font-size:85%;">rapid application development (RAD)</span></a><span style="font-size:85%;"> of </span><a title="Graphical user interface" href="http://en.wikipedia.org/wiki/Graphical_user_interface"><span style="font-size:85%;">graphical user interface (GUI)</span></a><span style="font-size:85%;"> applications, access to </span><a title="Database" href="http://en.wikipedia.org/wiki/Database"><span style="font-size:85%;">databases</span></a><span style="font-size:85%;"> using </span><a title="Data Access Objects" href="http://en.wikipedia.org/wiki/Data_Access_Objects"><span style="font-size:85%;">DAO</span></a><span style="font-size:85%;">, </span><a title="Remote Data Objects" href="http://en.wikipedia.org/wiki/Remote_Data_Objects"><span style="font-size:85%;">RDO</span></a><span style="font-size:85%;">, or </span><a title="ActiveX Data Objects" href="http://en.wikipedia.org/wiki/ActiveX_Data_Objects"><span style="font-size:85%;">ADO</span></a><span style="font-size:85%;">, and creation of </span><a title="ActiveX" href="http://en.wikipedia.org/wiki/ActiveX"><span style="font-size:85%;">ActiveX</span></a><span style="font-size:85%;"> controls and objects. </span><a class="mw-redirect" title="Scripting languages" href="http://en.wikipedia.org/wiki/Scripting_languages"><span style="font-size:85%;">Scripting languages</span></a><span style="font-size:85%;"> such as </span><a title="Visual Basic for Applications" href="http://en.wikipedia.org/wiki/Visual_Basic_for_Applications"><span style="font-size:85%;">VBA</span></a><span style="font-size:85%;"> and </span><a title="VBScript" href="http://en.wikipedia.org/wiki/VBScript"><span style="font-size:85%;">VBScript</span></a><span style="font-size:85%;"> are syntactically similar to Visual Basic, but perform differently.</span><a title="" href="http://en.wikipedia.org/wiki/Visual_Basic#cite_note-1"><span style="font-size:85%;">[2]</span></a><br /><span style="font-size:85%;">A programmer can put together an application using the </span><a class="mw-redirect" title="Software component" href="http://en.wikipedia.org/wiki/Software_component"><span style="font-size:85%;">components</span></a><span style="font-size:85%;"> provided with Visual Basic itself. Programs written in Visual Basic can also use the </span><a title="Windows API" href="http://en.wikipedia.org/wiki/Windows_API"><span style="font-size:85%;">Windows API</span></a><span style="font-size:85%;">, but doing so requires external function declarations.<br />In business programming, Visual Basic has one of the largest user bases. In a survey conducted in 2005, 62 percent of developers reported using some form of Visual Basic. It currently competes with </span><a title="C++" href="http://en.wikipedia.org/wiki/C%2B%2B"><span style="font-size:85%;">C++</span></a><span style="font-size:85%;">, </span><a title="C Sharp (programming language)" href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29"><span style="font-size:85%;">C#</span></a><span style="font-size:85%;"> and </span><a title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29"><span style="font-size:85%;">Java</span></a><span style="font-size:85%;"> for dominance in the business world. </span><a title="JavaScript" href="http://en.wikipedia.org/wiki/JavaScript"><span style="font-size:85%;">JavaScript</span></a><span style="font-size:85%;"> is another competitor to Visual Basic.</span><a title="" href="http://en.wikipedia.org/wiki/Visual_Basic#cite_note-2"><span style="font-size:85%;">[3]</span></a><br /><span style="font-size:85%;">The final release was version 6 in 1998. Microsoft extended support will end in 2008 and the designated successor is </span><a title="Visual Basic .NET" href="http://en.wikipedia.org/wiki/Visual_Basic_.NET"><span style="font-size:85%;">Visual Basic .NET</span></a><span style="font-size:85%;">.</span></div><div align="justify"><span style="font-size:85%;"></span> </div><div align="justify"><a href="http://en.wikipedia.org/wiki/Visual_Basic"><span style="font-size:85%;">Other Information Click Me.</span></a><span style="font-size:85%;"> - Topics from en.wikipedia.org</span></div>Saihttp://www.blogger.com/profile/16179339115560174128noreply@blogger.com0