Add Explorer Style Rename Capability to TreeView Control

Add Explorer Style Rename Capability to TreeView Control

Q192170
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows, versions 5.0, 6.0
- Microsoft Visual Basic Professional Edition for Windows, versions 5.0, 6.0
- Microsoft Visual Basic Enterprise Edition for Windows, versions 5.0, 6.0
--------------------------------------------------------------------------------

SUMMARY
The following procedure can be used to edit the node name on the TreeView side of the Windows Explorer:

- Click on a node with focus to place it in edit mode.
- Remove all the text from the Node label.
- Move focus to a different Node.

You receive the following error message:
You must type in a file name.
Focus returns to the Node you were editing and you remain in edit mode.
If you hit the Esc Key, the original text is placed back in the Node label.

MORE INFORMATION
This sample demonstrates how to achieve the same effect using the TreeView control in Visual Basic. It also shows how to verify that when a user edits a Node label that it is not left blank.

Step-by-Step Example
Create a new standard EXE project. Form1 is created by default.
From the Project menu, select Components, check "Microsoft Windows Common Controls 6.0," and then click OK.

Add a TreeView and Timer control to Form1.
Add the following to the code window of Form1:

Option Explicit

Dim sNodeText As String ' to hold the node text

Private Sub Form_Load()
'Add some nodes to the TreeView
TreeView1.Nodes.Add , , , "test"
TreeView1.Nodes.Add , , , "test 1"
TreeView1.Nodes.Add , , , "test 2"
End Sub

Private Sub Timer1_Timer()
' Put the TreeView in edit mode
TreeView1.StartLabelEdit
Timer1.Enabled = False
End Sub

Private Sub TreeView1_AfterLabelEdit(Cancel As Integer, _
NewString As String)
' Make sure that we have a value in the Label
If Len(NewString) < interval =" 100" enabled =" True"> 0 Then
sNodeText = TreeView1.SelectedItem.Text
End If
End Sub

Private Sub TreeView1_KeyUp(KeyCode As Integer, Shift As Integer)
' If the user hits the Esc key then restore the old label
If KeyCode = vbKeyEscape Then
TreeView1.SelectedItem.Text = sNodeText
End If
End Sub

Save and run the project. Click on a Node to select it, then click on it again to place it in edit mode.
Follow steps as described in the Summary above. When you hit the ESC key, you will see that the old value for the Node label has been restored.

(c) Microsoft Corporation 1998. All Rights Reserved.
Contributions by Brian Combs, Microsoft Corporation.

Additional query words: kbDSupport kbDSD kbVBp kbVBp500 kbVBp600 kbCmnCtrls kbTreeView
Keywords : kbGrpDSVB
Issue type : kbhowto
Technology : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB500Search kbVB600Search kbVBA500 kbVBA600 kbVB500 kbVB600

OLE DB syntax based on providers (Part. I)

OLE DB syntax based on providers (Part. I)

1. OLE DB Provider for Active Directory Service

oConn.Open "Provider=ADSDSOObject;" & _
"User Id=myUsername;" & _
"Password=myPassword"

Desc: Microsoft OLE DB Provider for Microsoft Active Directory Service.


2. OLE DB Provider for Advantage

oConn.Open "Provider=Advantage OLE DB Provider;" & _
"Data source=c:\myDbfTableDir;" & _
"ServerType=ADS_LOCAL_SERVER;" & _
"TableType=ADS_CDX"

Desc: Advantage OLE DB Provider for ADO


3. OLE DB Provider for AS/400 (from IBM)

oConn.Open "Provider=IBMDA400;" & _
"Data source=myAS400;" & _
"User Id=myUsername;" & _
"Password=myPassword"

Desc: Fast Path to AS/400 Client/Server


4. Microsoft OLE DB Provider for AS/400 and VSAM

oConn.Open "Provider=SNAOLEDB;" & _
"Data source=myAS400;" & _
"User Id=myUsername;" & _
"Password=myPassword"

Desc: See ConnectionString Property


5. OLE DB Provider for Commerce Server for Data Warehouse

oConn.Open "Provider=Commerce.DSO.1;" & _
"Data Source=mscop://InProcConn/Server=mySrvName:" & _
"Catalog=DWSchema:Database=myDBname:" & _
"User=myUsername:Password=myPassword:" & _
"FastLoad=True"

' Or

oConn.Open "URL=mscop://InProcConn/Server=myServerName:" & _
"Database=myDBname:Catalog=DWSchema:" & _
"User=myUsername:Password=myPassword:" & _
"FastLoad=True"

For Profiling System:

oConn.Open "Provider=Commerce.DSO.1;" & _
"Data Source=mscop://InProcConn/Server=mySrvName:" & _
"Catalog=Profile Definitions:Database=myDBname:" & _
"User=myUsername:Password=myPassword"

' Or

oConn.Open _
"URL=mscop://InProcConnect/Server=myServerName:" & _
"Database=myDBname:Catalog=Profile Definitions:" & _
"User=myUsername:Password=myPassword"
For more information, see: OLE DB Provider for Commerce Server, DataWarehouse, and Profiling System

VB Code: Validate Credit Card Number

VB Code: Validate Credit Card Number

This is just a small VB code to validate credit cards number, all credit cards work with this algorthm;

If the number is in a valid format if returns 'True'.

If the number is in an invalid format it returns 'False'.

If a card validates with this code it doesn't mean that the card is actually good, it just means that the numbers are arranged in a valid format.
If they don't validate then you've saved some time because you don't have to process the card to find out that it is definitely bad. You can use this function in CGI forms that process credit card orders.

'Code
Function CheckCard(CCNumber As String) As Boolean
Dim Counter As Integer, TmpInt As Integer
Dim Answer As Integer

Counter = 1
TmpInt = 0

While Counter <= Len(CCNumber)
If IsEven(Len(CCNumber)) Then
TmpInt = Val(Mid$(CCNumber, Counter, 1))
If Not IsEven(Counter) Then
TmpInt = TmpInt * 2
If TmpInt > 9 Then TmpInt = TmpInt - 9
End If
Answer = Answer + TmpInt
'Debug.Print Counter, TmpInt, Answer
Counter = Counter + 1
Else
TmpInt = Val(Mid$(CCNumber, Counter, 1))
If IsEven(Counter) Then
TmpInt = TmpInt * 2
If TmpInt > 9 Then TmpInt = TmpInt - 9
End If
Answer = Answer + TmpInt
'Debug.Print Counter, TmpInt, Answer
Counter = Counter + 1
End If
Wend

Answer = Answer Mod 10

If Answer = 0 Then CheckCard = True
End Function

'end code

Use MSWord spell corrector tools within VB

Use MSWord spell corrector tools within VB

If you would like to incorporate a Spellings Corrector in your VB app, it would take you quite a long time, this trick shows you in a simple example how to use MS Word´s Spelling Corrector within VB.

Create a new project with one form. Put a CommandButton and a TextBox on it.

Set the following properties of the textbox:
"Height = a couple of lines" Multiline=true ScrollBars=Vertical

'Code
Private Sub Command1_Click()
Text1 = SpellCheck(Text1)
End Sub

Public Function SpellCheck(ByVal IncorrectText$) As String
Dim Word As Object, retText$

On Error Resume Next

' Create the Object and open Word
Set Word = CreateObject("Word.Basic")

' Change the active window to Word, and insert
' the text from Text1 into Word.

Word.AppShow
Word.FileNew
Word.Insert IncorrectText

' Runs the Speller Corrector
Word.ToolsSpelling
Word.EditSelectAll

' Trim the trailing character from the returned text.

retText = Word.Selection$()
SpellCheck = Left$(retText, Len(retText) - 1)

' Close the Document and return to Visual Basic.

Word.FileClose 2
Show

'Set the word object to nothing to liberate the
' occupied memory

Set Word = Nothing
End Function

I used WordBasic because that way you can also use this tip with older versions of Word aswell. (by. Philip N)
Hide program in Ctlr-Alt-Del list

Hide program in Ctlr-Alt-Del list

If you press Ctrl-Alt-Del at the same time a listbox will appear and you can see all program that currently running in your computer, for some reasons may you want to hide your program from the list.

There's 2 method you can choose to do that;

The easiest way is by using the TaskVisible property of the App-object. If you set it to False, the task will be hiden from the CTRL-ALT-DEL-list. If you set it to True, your task will reappear again.

'Hide my program from list
App.TaskVisible = False
'Show on list
App.TaskVisible = True

Another way is by registering your program as a service. This is done by passing the process ID of your application to the RegisterService API.


Declarations
Copy the following code into the declarations section of a module:

Public Declare Function GetCurrentProcessId _
Lib "kernel32" () As Long
Public Declare Function GetCurrentProcess _
Lib "kernel32" () As Long
Public Declare Function RegisterServiceProcess _
Lib "kernel32" (ByVal dwProcessID As Long, _
ByVal dwType As Long) As Long

Public Const RSP_SIMPLE_SERVICE = 1
Public Const RSP_UNREGISTER_SERVICE = 0

'Declaration end here.

Procedures
To remove your program from the Ctrl+Alt+Delete list, call the MakeMeService procedure:

Public Sub MakeMeService()
Dim pid As Long
Dim reserv As Long

pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
End Sub

'procedure end here


To restore your application to the Ctrl+Alt+Delete list, call the UnMakeMeService procedure:

Public UnMakeMeService()
Dim pid As Long
Dim reserv As Long

pid = GetCurrentProcessId()
regserv = RegisterServiceProcess(pid, _
RSP_UNREGISTER_SERVICE)

'End Code


Don't forget to unregister your application as a service before it closes to free up system resources by calling UnMakeMeService.

How to create app manifest for VB in winXP

How to create app manifest for VB in winXP

This is a brief tutorial on creating an application manifest in Windows XP. Like we all know Windows XP comes with many new features and updates to the Common Controls Library. One of the main features is the Windows XP Themes. This allows you to select a theme, and the entire look and feel of Windows, as you know it will change.
However, if you were to write a program in VB, the buttons, textboxes you were to use, would not change. You need to tell Windows XP that you are going to use the new version of the Common Controls Library, and to do this you must include an application manifest. A manifest is an XML document that Windows XP searches for in the application’s directory when you open an application. This manifest tells Windows XP to use the new version of COMCTL32.DLL (Version 6).

Here is a brief tutorial::

- Load Microsoft Visual Basic and start a new project
- Now add a few standard controls, a button, a checkbox, 2 option buttons and a text box
- Give them captions, and program the button to Exit when clicked.

Private Sub Command1_Click()
Unload Me
End Sub

COMCTL32.DLL exports a function called InitCommonControls. This is exported in COMCTL32.DLL versions from Windows 95. This needs to be called when the application is started, to ensure that the common controls library is opened. The declaration is not available in the API viewer. Make sure that you use Form_Initialize and not Form_Load, to enter the code. So the code in the form should now read:

Option Explicit
Private Declare Function InitCommonControls Lib "comctl32.dll" () As Long

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Initialize()
InitCommonControls
End Sub

Now we need to compile this into an executable file (the manifest will only work when run as an EXE) and actually create the manifest. I have called my application COMCTLTest.EXE. You can call your executable anything, but that name needs to correspond with the name on the manifest.

Go to the folder, at which you have compiled the application into, load notepad and enter the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" processorArchitecture="*" version="6.0.0.0" name="mash"/>
<description>Enter your Description Here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
language="*"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
/>
</dependentAssembly>
</dependency>
</assembly>



Save this as:

<YOUR EXE NAME>.EXE.MANIFEST



So because I compiled my application as COMCTLTest.exe I would save my manifest as: COMCTLTest.EXE.MANIFEST

Now, you are ready to run your application. Double click on the executable, and there you are!! (by Phillip N)
Use Winsock Control to download webpages

Use Winsock Control to download webpages

Overview:
The Professional and Enterprise Editions of Visual Basic are shipped with the Winsock control. This control allows you to use the low level Windows Sockets to connect to remote servers and execute commands or download Web pages. This tip shows how to connect to a server and download a Web page.

You must have a Winsock control loaded into the project. This code assumes the control is called Winsock1. There also must be a text box on the form which is called txtWebPage.

Code:
First, connect to the remote computer using the following code:

Winsock1.RemoteHost = "microsoft.com"
Winsock1.RemotePort = 80
Winsock1.Connect

In the Winsock1.Connect event, place the following code to download the web page.

Dim strCommand as String
Dim strWebPage as String
strWebPage = "http://www.microsoft.com/index.shtml"
strCommand = "GET " + strWebPage + " HTTP/1.0" + vbCrLf
strCommand = strCommand + "Accept: */*" + vbCrLf
strCommand = strCommand + "Accept: text/html" + vbCrLf
strCommand = strCommand + vbCrLf
Winsock1.SendData strCommand

The Winsock control will attempt to download the page. When is receives some data from the server, it will trigger the DataArrival event.

Dim webData As String
Winsock1.GetData webData, vbString
TxtWebPage.Text = TxtWebPage.Text + webData

'end code
'coding by Phillip N
free web development text-editor

free web development text-editor

Looking just like Notepad, but this free text editor has special features added, such as colorization code, validation, auto-completion and more great variety of helper tools to speed up your programming.

"Netpadd can make backups of the current file, it has file sharing options within an intranet, it can display an (X)HTML document tree to validate the source. You can start a Java compile, call up a complete CSS syntax help. You can load files of any size. You have a code colorizer recognizing XML, XHTML, XSL, ASP, JSP, PHP.
There's a second clipboard. A jump to a line feature. Solid search, and search & replace, of course. You can convert characters to HTML, or look up special characters. You can see the output of an XSL transformation. You can convert tabs to spaces of your defined length. There's auto-completion features. You can easily wrap text with tags. Any many more things."


Download Netpadd
Visit website
Simple MP3 Player

Simple MP3 Player

VB MP3 Player is an easy and simple MP3 Player written in Visual Basic 6. It does not use the Windows Media Player plugin, only windows MCI. The player should play MP3, WAV and MIDI files.

The VB Runtime 6.0 files are required for running the player.
The file 'modShapedForm.bas' was created with TracEr (a program made by Richard Leitao, it's free and can be downloaded from vbside.com.

What's new:

* In the open dialog, the multi-select is allowed.
* The menu can be also opened from the playlist window.
* WAVE files are now supported.
* Now it's possible to open MP3 files with the command line.
* New tooltip for the timer that shows the file length.
* New tooltip for the playlist that shows the full name of the selected file.

Download VBMP3 Player: (source) - (exe)
Visit Project website
VB6.0 Sample: MSComm Control Techniques

VB6.0 Sample: MSComm Control Techniques

NewVBTerm.exe is a sample that demonstrates various MSComm control techniques that include answering the modem, simple text file transfer, data receipt and processing, packet reassembly, and use of the OnComm event.

NewVBTerm.exe is a sample that demonstrates various MSComm control techniques that include answering the modem, simple text file transfer, data receipt and processing, packet reassembly, and use of the OnComm event.

Download NewVBTerm.Exe
www.microsoft.com


Stop the Visual Basic scrollbar flashing

Stop the Visual Basic scrollbar flashing

The problem with the Visual Basic Scrollbar is that it flashes. This is to indicate that it has focus. You can either set the Focus to something else on a form when the Scrollbar receives focus, or set the TabStop property to False:

Scrollbar.TabStop = False

You will need to have another control on the form. If there isn't one the scrollbar will continue to flash. A PictureBox is a good control for this because it can receive focus but has no visible indication of this.

taken from qbdsoftware.co.uk
Snippets Code Storage

Snippets Code Storage

Snippet Bank1.1 is a coders database for the storage and retrieval of reusable code snippets. It offers search, query, search and replace, unlimited categories and export to clipboard functions and is VERY simple to use.

It is useful to software and web programmers and contains NO adware, spyware or backdoor technologies of any kind. If it's a simple and fast code database you are after, help yourself to a copy.

Download Snippet Bank v1.
http://software-zone.com


Sign up for PayPal and start accepting credit card payments instantly.
Complete Code Protector

Complete Code Protector

Code Security is a great VB Tools from G-soft, Code Security is a very small program but it's powerful to protect and compress your programs including all dll & OCX Files. Makes your application more secure and keep light..

G-Soft Code Security Uses UPX To Compress Programs And Secret Methods To Protect Programs.


Download Code Security 1.0
http://www.softplatz.com
Source code and database code generator

Source code and database code generator

iCodeGenerator is a free tools database centric template based code generator for any text(ascii) programming language like C, PHP, C#, Visual Basic, Java, Perl, Python...
Supported databases are SQL Server, MySQL and PostgreSQL.

Project Admins: victoryoalli
Operating System: All 32-bit MS Windows (95/98/NT/2000/XP)
License: GNU General Public License (GPL)
Category: Database, Code Generators, Interpreters


Download iCodeGenerator

http://sourceforge.net/projects/codegenerator/
CodeBank v2 Personal Data

CodeBank v2 Personal Data

CodeBank v2 is tree based (XML) personal information database. It allows you to maintain a hierachical database of textual information like:

* programming code snippets
* notes
* links
* quotes
* SQL queries
+ whatever you like you name it

Unlike similar programs CodeBank is fully portable and can be carried on removable media.The internal search engine can search for words, phrases and regular expressions.


Download CodeBank v2
by nikola dachev


web-based payroll and time management suite

web-based payroll and time management suite

TimeTrex is a complete web-based payroll and time management suite which offers employee scheduling, attendance (timeclock, timesheet), job costing, invoicing and payroll all in tightly integrated package.

Project Admins: ipso
Operating System: OS Independent (Written in an interpreted language)
License: Mozilla Public License 1.1 (MPL 1.1)
Category: Financial, Scheduling, Time Tracking

TimeTrex_Standard_Edition_v2.0.3

visit project page here
time attendance system

time attendance system

Time and attendance system with payroll/salaries/tax deductions/allowances/multiple shifts/schedules/scheduleapplicator/employees/policies and is compatible with RFID(some)/barcode/Digital persona microsoft/Implements camera webcam / fingerprint reader.


Download time attendance system
Download Supporting file fonts.zip & keygen.zip

Get the VBCode Collection on CD

Koleksi lengkap VB project bermacam aplikasi sebagai referensi belajar, dengan fasilitas Program penyimpan koleksi code, disusun berdasarkan folder yang dapat ditambah sesuai keperluan, fungsi tambah, edit, hapus data.
PLUS fasilitas searching sample code dari 18.464 file koleksi sample code untuk bermacam aplikasi.
Dipandu langsung oleh Mbah Merlin (Utusan Khusus dari Microsoft Agent :-)... )


Packing: 1 C CDROM

Total Folder: 26

Total size: 536MB
Total File: 18.464

Total VB Project: 649.

Dapatkan dan miliki Jajanan Awet ini. (Solusi Belajar & Menambah wawasan skill programming VB).

SMS pesanan ke: 0813-9844-9733

Search Koders.com faster without a browser

Koders IDE Plug-ins enable software developers to perform Koders searches directly from within the Eclipse or Visual Studio development environments by extending the reach of the Koders.com open source code index to the desktop. Koders offers plug-ins for Eclipse 3.0 and above, as well as Visual Studio.NET 2003 and 2005.

Search Koders.com faster without a browser

* The Koders search panel is displayed as a toolbar component within the IDE
* Search directly from the editor by right clicking on a term
* Localize the plug-ins for additional languages
Let SmartSearch™ work for you
* SmartSearch™ finds and recommends existing source code in real-time

* SmartSearch™ runs transparently in the background, as you work.


More Plug-in Information

* Learn more about Koders Desktop IDE Plug-ins

* SmartSearch™ demo with audio (~5 MB)

Visit the official website to read details and download free source code!