Search VB 2010

Showing posts with label Application development. Show all posts
Showing posts with label Application development. Show all posts

Monday, May 04, 2015

Purchase, Sales and Stores application

Purchase, Sales and Stores application

P.O.S (Point Of Sales)

برنامج المشتريات و المبيعات و المخازن

الشاشات الرئيسية للبرنامج 

  1. الرئيسية : حيث يجب تسجيل دخول المستخدم أولا حيث أن جميع العمليات تكون باسمه و بحسب طلب صاحب البرنامج.
  2. العملاء :حيث يتم تسجيل العملاء, و ايضا امكانية معرفة الارصده الدائنة و المدينه الخاصة بهم .
    برنامج المشتريات و المبيعات - العملاء
  3. الموردين : حيث يتم تسجيل الموردين, و ايضا امكانية معرفة الارصده الدائنة و المدينه الخاصة بهم .
    برنامج المشتريات و المبيعات -الموردين
  4. المخازن : حيث يتم انشاء المخازن و اضافة الاصناف لها. و معرفة رصيد كل مخزن.
    برنامج المشتريات و المبيعات- المخازن
  5. الأصناف : تسجيل الأصناف المتعامل بها و الوحدات و الأنواع مما يسهل التعامل فى كافة الأنواع و الأصناف
    برنامج المشتريات و المبيعات-الأصناف
  6. المشتريات : اجراء عمليات الشراء (الاجل - النقدى) من الموردين
  7. المبيعات : اجراء عمليات البيع (النقدى و الاجل) للعملاء
  8. المصروفات : تسجيل المصروفات اليومية المتغيره و الثابته
  9. النقدية : نقدية خاصة بالعملاء - نقدية خاصة بالموردين - اجمالى النقدية فى أى تاريخ
  10. التقارير : جرد الكميات - الأصناف - فواتير البيع و الشراء - النقدية الاجلة - العمليات فى أى تاريخ
  11. اعدادات البرنامج : التحكم فى قاعدة البيانات و خلفية البرنامج
  12. اعدادات الدخول : تسجيل الموظفين و المستخدمين للبرنامج .

طريقة عمل البرنامج :

أولا : من شاشة الأصناف يتم تسجيل الأنواع (مثل : سونى - سامسونج - نوكيا - لافايس - رانجلر - اديداس)
ثانيا : من شاشة الأصناف يتم تسجيل الوحدات (مثل : موبيل - اكسسوار - شنطه - حذاء - لعبه)
ثالثا : اضافة الأصناف و هى شاشة بديلة للباركود (البرنامج يمكن تعديلة للعمل بالباركود مباشرة حسب الطلب) عن طريق اعطاء رقم للصنف و اسم للصنف بالاضافة الى نوعه و وحدته.
رابعا : انشاء مخزن (مثال : كل الأصناف) يتم تسجيل كل الاصناف به.
خامسا : يجب تسجيل شراء البضاعه أولا بفواتير أو فاتورة مجمعه بها كل الأصناف.
سادسا : فى حالة البيع يتم البيع من المشتريات أو من المخزن (سيان)
سابعا : فى حالة العمليات الاجلة نجدها فى النقدية (عملاء - موردين) حيث يتم زيادة أو تقليل المبالغ الاجلة حسب الدفع .
ثامنا : طباعة التقارير اللازمه من فواتير و جرد .

سعر البرنامج :

البرنامج تكلفته 2000 جنيه مصرى شاملة النقل و التركيب و الصيانه بدون مصاريف شهرية (الا فى حالة التعديل على البرنامج), للاستعلام :
تليفون : 01002851540
تليفون : 01200908486

نسخه تجريبية لمدة 3 شهور :

Mediafire


Here are some online Visual Basic lessons and courses :

Sunday, April 13, 2014

VB 2010 Crystal Reports Errors

Visual Basic Online Course - Crystal Reports for VB2010 Errors and Solutions

Error (1)
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified. how can solve this error in windows application 
 Solution
Add those lines to your App.Config file located in your VB2010 Solution Explorer Panel
and Run your application again.


Error (2)
Crystal Reports Database Login box. Some time Crystal Reports run perfectly on your machine (Developer Machine) but after deploying it and install it on another Machine, it gives you an error like this :
VB2010 Crystal Reports Database Location Error
 Solution
Add those lines to your Form_Load where the report is being loaded to adjust the Database location (Microsoft Access 2003 Database) :

Error (3)
Crystal Reports 2010 doesn't insert pictures manually. When you try to insert a photo into the Crystal Reports 2010 it doesn't take any action. Inserting pictures in Crystal Reports 2010 doesn't work.
Crystal Reports 2010 is not inserting images in the report
Crystal Reports 2010 is not inserting images in the report
 Solution
I've tried many sites and many solutions but I've never figured out the error pattern, or why does Crystal Reports not letting me insert any photo of any kind (JPEG, JPG, PNG) or resolutions. But I landed on this solution and it is working fine with me, and it seems the only solution I've now :
1) Right-click on the report while in the design
2) Choose Insert, then choose Picture
3) Single Left-click the on the photo you wish to insert
4) Click Open, you will notice the image box appears on the report
5) Place the Image box any where on the report and you will see it there.
- I used to double-click the image in the Dialog Box where I choose the Image but that did not work with me, now when I use 'Open', it is working 'Silly'

Error (4)
Crystal Reports 2010 Logon failed for Microsoft Access 2003/2007/2010 Protected Database with password.
This happens when we try to connect the Crystal Report with MS-Access Database in VB 2010 using the code (Programmatically).
Note that it won't happen we connect the Crystal Report with access protected database using the wizard, we just use the (Jet Database Password) field instead of (Database Password) field to provide the report with your Database Password.
VB 2010 Crystal Report MS-Access Password Protected Database
 But, to do this programmatically using code in VB 2010, you notice you always get "Logon Failed" Error message, using something like this :

And you get this error message :

 Solution
After many trials and tests, I've found out the only solution for this problem is to connect dynamically to Crystal Reports in VB 2010 using code is through the DataSet and DataTable Objects, here is the code to accomplish this :

Here is a full example on :
- Connecting protected MS-Access 2007 database with VB 2010
- Insert Data into Database fields
- Delete Data from Database Table
- Connect Crystal Report with VB 2010 and MS-Access protected Database Programmatically
- Update Crystal report without problems when updating MS-Access protected Database.

Wednesday, February 12, 2014

Visual Basic Online Course - Make sure application is running and installed



Visual Basic Online Course

How to make sure that an Application is Running and Installed

VB 2010 Make sure application is running
Visual Basic Online Course - Tips

When you create a Visual Basic 2010 or generally a VB.Net application that relies on another VB.Net application for example an Updater.exe application, you will have to code both sides in order no to enable the user to run Updater.exe without the existence of the Main application, and in order to do so, you will have to make sure that :
1) Your Main application is Running.
2) Your Main application is Installed.
3) Your Main application does exist in the installation folder.
After making sure of all the above points, then you can compile your updater.exe file with your Main Application knowing that updater.exe won't run alone, especially if you're sending updates to the Main application for the user to receive using Updater.exe.

Here are the code to do so :
1) VB 2010 Get list of all installed applications

2) VB 2010 Get list of all running applications

3) VB 2010 Make sure application exists

Thank you for reading, download VB 2010 Project from here

Here are some online Visual Basic lessons and courses :

Wednesday, February 05, 2014

Visual Basic Online Course - Read Text File

Visual Basic 2010 - How to Read Text File(s)

VB 2010 Read Text Files
VB 2010 Read Text Files
Introduction

In order to read from a Text File then a Text File has to be present (Present = Known Path), the path of a Text File is just like any other path of any file it is String, for example :
C:\Folder\File.txt
The path to the File.txt is (C:\Folder\File-Name.Extension), so the path to the File Text = Path + File-Name + extension. Text Files can be present locally (on the same machine) or from external place (on the web) for example :
ftp://10.0.0.27/Folder/File.txt
As long as this Path is present and accessible then Reading Text File in VB 2010 is just so easy job to do. We can store the path to the Text File into a String variable to use it in our VB 2010 project :
Dim LocalFilePath as String = ("C:\Folder\File.txt")
Dim WebFilePath As String = ("ftp://10.0.0.27/Folder/File.txt")
The problem with Text Files hosted on the web, is that it has to be accessible in order to read it or write it, you have to provide  a User Name and Password to gain access to those files for most of the times because of security issues, unlike reading Text Files from local storage devices, there is no need to provide credentials or authentications to be able to read them.

Reading from Local Text Files in VB 2010

We will use File Reader to read String stored in a Text File,we will use basics of reading Text Files.

1) Create VB 2010 Windows Form Project (WindowsApplication1) and save it to (D:\)
2) Add TextBox (Name : TxtFromFile, MultiLine : True)
3) Create Text File (MyFile.txt) and place it in the project folder
Path to MyFile.txt is (D:\WindowsApplication1\Bin\Debug\)
4) Write to MyFile.txt those two lines :
Hello
Visual Basic Online Course
5) Save and close the file.

Now, the project will :
Open the Text File to read on the Form_Load() event
Displays the String in the TextBox (TxtFromFile)

Code


Here are some online Visual Basic lessons and courses :

Sunday, February 02, 2014

Visual Basic Online Course Fade Image

Fade Image in VB 2010

VB 2010 Fade Image
VB 2010 Fade Image
How to fade image in Visual Basic 2010

It doesn’t matter if you are a photographer or a graphic designer, chances are that you have come across the need to fade or blend images in Visual Basic 2010. You can always use Photoshop to create faded images and then use them in your VB 2010 applications, but as a developer you also have to know what does it take to do so, not just to fade an Image but also as a general, after all it's your job to come up with answers.

In our demonstration here well will use ordinary common tools in VB 2010 to be able to fade an Image.

Project Design
 
VB 2010 Example to Fade Image
VB 2010 Example to Fade Image
Form
Name : Form1
Text : Fade Image in VB 2010
PictureBox
Name : PicToFade
BackColor : Transparent
Dock : Full
Timer
Name : Timer1
Interval : 100

How does it work 

Run the application, click on the PicToFade [PictureBox], it will show the [OpenFileDialog] choose and Image [JPEG] and then notice that it will begin to fade away.

You can alter the code to change the fading values [Alpha from 0 to 1 and DeltaAlpha], you can use a Progressbar control to change the fading values too.

Source Code

Download Source Code
MediaFire.com fade image

Here are some online Visual Basic lessons and courses :

Wednesday, January 15, 2014

Visual Basic 2010 Read/Write Command Prompt

Visual Basic Online Course - Command Prompt

Read / Write Windows Command Prompt from VB 2010

Read / Write Windows Command Prompt from Visual Basic 2010

Command Prompt

A command prompt is an entry point for typing computer commands in the Command Prompt window. By typing commands at the command prompt, you can perform tasks on your computer without using the Windows graphical interface.

Command Prompt Commands

(A)
ADDUSERS Add or list users to/from a CSV file
ARP Address Resolution Protocol
~ ASSOC Change file extension associations
ASSOCIAT One step file association
AT Schedule a command to run at a later time
ATTRIB Change file attributes

(B)
BOOTCFG Edit Windows boot settings
BROWSTAT Get domain, browser and PDC info

(C)
CACLS Change file permissions
~ CALL Call one batch program from another
~ CD Change Directory - move to a specific Folder
CHANGE Change Terminal Server Session properties
CHKDSK Check Disk - check and repair disk problems
CHKNTFS Check the NTFS file system
CHOICE Accept keyboard input to a batch file
CIPHER Encrypt or Decrypt files/folders
CleanMgr Automated cleanup of Temp files, recycle bin
CLEARMEM Clear memory leaks
CLIP Copy STDIN to the Windows clipboard.
~ CLS Clear the screen
CLUSTER Windows Clustering
CMD Start a new CMD shell
~ COLOR Change colors of the CMD window
COMP Compare the contents of two files or sets of files
COMPACT Compress files or folders on an NTFS partition
COMPRESS Compress individual files on an NTFS partition
CON2PRT Connect or disconnect a Printer
CONVERT Convert a FAT drive to NTFS.
~ COPY Copy one or more files to another location
CSCcmd Client-side caching (Offline Files)
CSVDE Import or Export Active Directory data

(D)
~ DATE Display or set the date
Dcomcnfg DCOM Configuration Utility
DEFRAG Defragment hard drive
~ DEL Delete one or more files
DELPROF Delete NT user profiles
DELTREE Delete a folder and all subfolders
DevCon Device Manager Command Line Utility
~ DIR Display a list of files and folders
DIRUSE Display disk usage
DISKCOMP Compare the contents of two floppy disks
DISKCOPY Copy the contents of one floppy disk to another
DISKPART Disk Administration
DNSSTAT DNS Statistics
DOSKEY Edit command line, recall commands, and create macros
DSADD Add user (computer, group..) to active directory
DSQUERY List items in active directory
DSMOD Modify user (computer, group..) in active directory

(E)
~ ECHO Display message on screen
~ ENDLOCAL End localisation of environment changes in a batch file
~ ERASE Delete one or more files
~ EXIT Quit the current script/routine and set an errorlevel.
EXPAND Uncompress files
EXTRACT Uncompress CAB files

(F)
FC Compare two files
FIND Search for a text string in a file
FINDSTR Search for strings in files
~ FOR /F Loop command: against a set of files
~ FOR /F Loop command: against the results of another command
~ FOR Loop command: all options Files, Directory, List
FORFILES Batch process multiple files
FORMAT Format a disk
FREEDISK Check free disk space (in bytes)
FSUTIL File and Volume utilities
FTP File Transfer Protocol
~ FTYPE Display or modify file types used in file extension associations

(G)
GLOBAL Display membership of global groups
~ GOTO Direct a batch program to jump to a labelled line

(H)
HELP Online Help 

(I)
~ IF Conditionally perform a command
IFMEMBER Is the current user in an NT Workgroup
IPCONFIG Configure IP

(J)
KILL Remove a program from memory

(L)

LABEL Edit a disk label
LOCAL Display membership of local groups
LOGEVENT Write text to the NT event viewer.
LOGOFF Log a user off
LOGTIME Log the date and time in a file

(M)

MAPISEND Send email from the command line
MBSAcli Baseline Security Analyzer.
MEM Display memory usage
~ MD Create new folders
MKLINK Create a symbolic link (linkd)
MODE Configure a system device
MORE Display output, one screen at a time
MOUNTVOL Manage a volume mount point
~ MOVE Move files from one folder to another
MOVEUSER Move a user from one domain to another
MSG Send a message
MSIEXEC Microsoft Windows Installer
MSINFO Windows NT diagnostics
MSTSC Terminal Server Connection (Remote Desktop Protocol)
MUNGE Find and Replace text within file(s)
MV Copy in-use files

(N)
NET Manage network resources
NETDOM Domain Manager
NETSH Configure network protocols
NETSVC Command-line Service Controller
NBTSTAT Display networking statistics (NetBIOS over TCP/IP)
NETSTAT Display networking statistics (TCP/IP)
NOW Display the current Date and Time
NSLOOKUP Name server lookup
NTBACKUP Backup folders to tape
NTRIGHTS Edit user account rights

(P)
~ PATH Display or set a search path for executable files
PATHPING Trace route plus network latency and packet loss
~ PAUSE Suspend processing of a batch file and display a message
PERMS Show permissions for a user
PERFMON Pe

Example 

1) Copy / Paste filesCopy - This command allows you to copy files from one location to another. To use this command you would type
copy filetocopy copiedfile
For example if you have the file D:\test\test.txt and would like to copy it to c:\windows\test.txt you would type
copy D:\test\test.txt c:\windows\test.txt
and press enter. 
If the copy is successful it will tell you so and give you back the prompt. If you are copying within the same directory you do not have to use the path. 

Here are some examples and what they would do:
copy File.txt ThisFile.bak     Copies the File.txt file to a new file called ThisFile.bak in the same directory
copy File.txt \windows     Copies the File.txt file to the \windows directory.
copy * \windows     Copies all the files in the current directory to the \windows directory.

Redirectors

Re-directors are an important part to using the command prompt as they allow you to manipulate how the output or input of a program is displayed or used. Re-directors are used by appending them to the end of a command followed by what you are redirecting to. For example: Dir > DirOutPuts.txt. There are four re-directors that are used in a command prompt and they are discussed below:

>     This re-director will take the output of a program and store it in a file. If the file exists, it will be overwritten. If it does not exist it will create a new file. For example the command dir > DirOutPuts.txt will take the output of the Dir command and place it in the DirOutPuts.txt file. If dir.txt exists, it will overwrite it, otherwise it will create it.

>>     This re-director will take the output of a program and store it in a file. If the file exists, the data will be appended to the current data in the file rather than overwriting it. If it does not exist it will create a new file. For example the command dir >> dir.txt will take the output of the dir command and appends it to the existing data in the Dir.txt file if the file exists. If dir.txt does not exist, it will create the file first.

<     This re-director will take the input for a program from a specified file. For example the date command expects input from a user. So if we had the command date < date.txt, it would take the input for the date program from the information contained in the date.txt file.

|     This re-director is called a pipe. It will take the output of a program and pipe it into another program. For example Dir | sort would take the output of the dir command and use it as input to the sort command.

How do we use of those info in Visual Basic 2010 ?

There are so many benefits of using Command Prompt Commands in VB 2010, I will give an example of comparing two EXE file (Windows Application) using FC command from VB 2010 which I know is needed most by many developers, there are some tools that actually do that and are based on the usage of FC command.

Example : Compare two applications is called Binary Diff. , FC command operate a comparison process based on the location of the two *.exe files and return the result like this :
xxxxxx: yy zz
The value of xxxxxx specifies the relative hexadecimal address for the pair of bytes, measured from the beginning of the file. Addresses start at 00000000.
The hexadecimal values for yy and zz represent the mismatched bytes from filename1.exe and filename2.exe , respectively.

Syntax :
FC  [drive1:][path1]filename1.exe [drive2:][path2]filename2.exe /B
[drive1:][path1]filename1 : Specifies the location and name of the first file you want to compare. Filename1 is required.
[drive2:][path2]filename2 : Specifies the location and name of the second file you want to compare. Filename2 is required. 
/B  : Compares the files in binary mode. FC compares the two files byte by byte and does not attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files that have the following file extensions: .exe, .com, .sys, .obj, .lib, or .bin.

To make use of the example :
Create any Visual Basic 2010 Project [Windows Form]
Build it, so you would have an EXE file in Bin\Debug
Copy the exe file to another Dir called C:\Comp, and rename it to (CS.exe)
Edit your Visual Basic 2010 Source Code (Add any line of code)
Build menu : Clear Solution
Build menu : Build solution
now you have another version of the exe file
Rename your recent exe file (Cexe.exe) and paste it in C:\Comp folder with the previous exe file
Now you have 2 different exe (CS.exe and Cexe.exe) files in C:\Comp folder and we want to compare them as Binary Diff.

Create new VB 2010 Project, like this :
VB 2010 Command Prompt
Compare two windows applications in VB 2010 using Command Prompt FC Command
Form
Name : form1
Caption : Compare two exe files
TextBox
'Contains the command Line FC
Name : TextBox1
MultiLine : True
Text :
@Echo Off
FC C:\comp\CS.exe C:\comp\Cexe.exe /B
TextBox
'Will contain the Comparison result of the two EXE application files.
Name
: TextBox2
MultiLine : True
Text :Comparison Result will display here ...
Button
'Executes the Command Line FC in the TextBox1
Name : Button1
Text : Go

Visual Basic Code : Open code area, clear it and paste the following codes ....

Run your application. The result will be like this :
VB 2010 Binary Diff example
Comparison Result of Comparing two windows applications using FC command from VB 2010
You can extend your work further and further ..... If you have any questions please comment. Thank you for reading Visual Basic Online Course - Command Prompt

Here are some online Visual Basic lessons and courses :

Saturday, January 11, 2014

Visual Basic Freelance Requirements Document, Event Planning Document and Use Case Definition

Visual Basic Freelance Job - Understanding a client needs
Visual Basic Freelance Job - Understanding a client needs

Writing Requirements Document

 is a *.Pdf, *.Doc, *.Docs, *.Xml file describes what the your client needs from you "An Application" including but not limited to (Application Title, Purpose, Algorithms procedures and conditions, Notes and restrictions, Comments) these were the most famous requirements and your job as a programmer is to study well these points and design your applications according to it. Another way is to write it for your client if required, sometimes clients need to understand what you've done as a programmer, maybe they will hire some else in the future when you are not available.

This is different from VB .Net Documentations you won't be needing codes or anything, everything depends one the client's request or who ever requests it from you, as a programmer asked to provide this document, honesty is a must, you need to provide the client with everything, starting your logic to deploying methods and you shall accept to do it or not, it is controversial subject.

In the other hand 90% or Requirements Docs are provided by the client or requested by the contractor (Programmer) to ensure that his work (Application) will meet the client's demands to the fullest or at least almost the fullest.

The Requirements Doc. always/must be provided before the application's beginning by the client's to the programmer or along with the application by the programmer to the client.

Writing Event Planning Document 

is the same as the Requirements Doc. format file. It describes what is going on the application's interface UI, specifically describes what happens (The event) when the client's user will click on something on your form or the form_load event itself.
For example, if you have a button in your applicaiotn you will provide its name and the events that are bound to it (Click, DBLClick,. .... etc) and what happens when the client's perform an event of those above, most Planning Events Docs are tables design.

It is provided when requested and as the Requirements Doc. it is a controversial point of view between the prgrammer and the client, you may or you may not provide it if requested.

The VB .Net Event Planning Doc. always/must be provided if agreed by your side as a programmer (contractor), you will describe each and every control's event triggers in your application to the client.

The VB .Net Event Planning Doc. always provided to the client along with application or after, and may be designed and logically configuered by the programmer before writing the codes or designing the UI (User Interface), it should give a full understanding description to the methods used in desgining the User Interface and events related to each control.

Writing Use Case Definition 

is the same as the Requirements Doc. and the Event Planning Doc.'s format file. It describes the logic of/in the application you provide as a programmer to the client if requested. But this time it is a 50\50 chances, means it could be requested by the client or by you and also it should give you as a programmer the mean to reach the client's ideas about the application.

The Use Case Definition if requested by the programmer, means that the programmer is seeking the best image in the client's head and he wants to fully satisfies his client. If requested by the client means that the client already knows what he is seeking he is not just looking for a programmer, no! he is looking for a programmer to do this as he has in mind, maybe he already saw something and wants the exact same thing.

The Use Case Definition is more like terms to the programmer but also relieves him from over coding events that are not really needed ofcourse if asked by the client's side.

All of the 3 Documents ( Use Case Definition, equirements Doc and Event Planning Doc.) depends on the contract between you and the client. I will show you how to do it in a small application project using VB .Net 2010 as if provided\requested by a client soon.4

Here are some online Visual Basic lessons and courses :

Sunday, December 15, 2013

Visual Basic Compare Two Treeviews and return differences

Visual Basic 2010 - Compare Two Strings and return differences and matches

vb2010 compare strings and return differences
VB2010 Compare Strings in Collections

Collections as an Alternative to Arrays

Visual Studio 2010
Although collections are most often used for working with the Object Data Type, you can use a collection to work with any data type. In some circumstances, it can be more efficient to store items in a collection than in an array.



If you need to change the size of an array, you must use the ReDim Statement (Visual Basic). When you do this, Visual Basic creates a new array and releases the previous array for disposal. This takes execution time. Therefore, if the number of items you are working with changes frequently, or you cannot predict the maximum number of items you need, you might obtain better performance using a collection.

A collection, which does not have to create a new object or copy existing elements, can handle resizing in less execution time than an array, which has to use ReDim. But if the size does not change, or changes only rarely, an array is likely to be more efficient. As always, performance is highly dependent on the individual application. It is often worth your time to try both an array and a collection.

This Example

How to compare two Treeviews in VB2010
How to return the differences between two Treeviews

Solution

- Create Visual Basic 2010 Windows Application Project
- On Form1, place two tree views and two textboxes and one button

Visual Basic Online Course
Visual Basic 2010 Compare Strings from Treeview
How does it work ?
- Store the Treeview1 [TRV1] nodes into Textbox, and the same with Treeview2 [TRV2]
- How many strings [Lines] in each Textbox

  • We want to find where both Textboxes is different and where both Textboxes is match to one another. For example, differences are :
- TRV1 has an extra string [Southern American]
- TRV2 node string [Africa] is different from TRV2 node string [African]

Steps to accomplish this task :





Download example from Mediafire
Extended work :
You can easily extract any Database tables, columns Schema into a treeview control, and you can also using this example compare two tables or two columns in a Database using this example as well.

You can use ListViews or ComboBoxes or ListBoxes instead of the Treeview control, I used the treeview control because it's always tricky to work with. Using other controls that store strings in Collection format would be so easy, even much easier than using Treeviews.

Another Treeview Examples

Expand and Collapse two treeviews at the same time according to one another even if they both don't have the same nodes names. Expand TreeView1[TRV1] node when TreeView2 [TRV2] node is expanded or collapsed.

TreeView Example : Change the node font

TreeView Example : Add a photo (icon) to the TreeView
1) Add ImageList from the ToolBox
2) Add 2 photos to the ImageList1 [From properties, Collection], for example :
- Photo1.Png (Index by default is Zero 0), this will be the Parent icon
- Photo2.Png (Index by default is One 1), this will be the first child icon
3) Code to display image/Icon in the Tree View :


Here are some online Visual Basic lessons and courses :

Saturday, November 02, 2013

VB 2010 Advantage Database Example

Sybase Advantage Database With Visual Basic 2010

Update Sybase Advantage Database using XML file from Visual Basic 2010 [Client-Server] Idea.
Update Sybase Advantage Database using XML file from Visual Basic 2010 [Client-Server] Idea.
1. Create New VB2010 Windows Application Project
2. Path to Project (I.e. D:\MySyBase\)
3. Path to Database (I.e. D:\MySyBase\Bin\Debug)
4. Sybase Advantage Database (MyDB.add)
5. Sybase Advantage Database Username : AdsSys - Password : ahmed
6. Sybase Advantage Database Table (I.e. MyInfo.adt)
We will create a personal Info application, so the table structure will be like that :
Sybase Advantage Database
Visual Basic 2010 - Sybase Advantage Database
Note : All other fields will vary in [Size] only but all fields are [cicharacter] Data Type.

Visual Basic Form Deign :
Visual Basic 2010
Visual Basic Online Courses
Note : I have made TextBoxes with Naming convenient (I.e NameTxt, EmailTxt, MobileTxt .... etc). Also I've placed 1 DataGridView and some Buttons. I also have 1 Module [Module1].

SaveBtn : Save new record to the Advantage Database
SearchBtn : Search for records using by Sname
EditBtn : After search, edits the record
DeleteBtn : After search, deletes the record
CancelBtn : Reset the form and the DataGridView
ExitBtn : Exits the application

In order to use Sybase Advantage Database with Visual Basic 2010 and just like any other Database, you must call the References to the Database :
Visual Basic 2010 - Add Reference to Sybase Advantage Database

The Codes
Module1

Form1
Sub ClearAll()
Private Sub Form_Load()
Private Sub ExitBtn_Click()
Private Sub SaveBtn_Click()
Private Sub SearchBtn_Click()

Private Sub CancelBtn_Click()
Private Sub EditBtn_Click()
Private Sub DeleteBtn_Click()

Note : You will need 2 Pictures PNG [On : Off] to refer to the Database Status, path [..Bin/Debug].

Another Lesson : How to Remote Database using XML :

1) Create an XML file in path [.\bin\Debug\] Folder and call it [XmlFile.xml]
2) Open [XmlFile.xml] with NotePad.exe and paste the following code into it :

3) Save the Xml file.
4) Open our VB 2010 Project and add a ToolStrip to the Form1, Dock = Buttom
ToolStrip VB 2010 Xml Database Update
ToolStrip VB 2010 Xml Database Update
5) How does it work "The Main Idea" : When you want to Alter structure or Edit the Advantage Database of your Advantage Database "DB.Add" on a Client's "User's" computer you will need to do something like what I did, easy and guaranteed. Find a Server and send SQL Statements to the Xml File and when the user checks for update [Check For Update] button, the application will open the XmlFile.xml and execute the Sql-Statement within, simply like that. When you use Version Number along with the update, it makes the Update process so easy to be tracked, so we will need to create and extra Database Table in the Advantage Database and call it [DB_Version].
6) DB_Version table structure :
Update Advantage Database [MyDB.Add] using XML and Visual Basic 2010
Update Advantage Database [MyDB.Add] using XML and Visual Basic 2010
Note : UpdateDT column is Date DataType.
7) Now each time you send updates to XML file, the user Checks for update and choose the XML file from Open Dialog Box and it compares the Date and Version of the Update, if New then it executes the Sql Statement line, if not, then it gives message [MsgTxt.Text] You're Up-To-Date.
8) Download Example from MediaFire.com [Testing.ZIP]

AdsConnection GetSchema tip :

How to retrieve Advantage Data Dictionary Schema in VB 2010.
VB 2010 GetSchema - Retrieve Tables, Columns From Ads Data Dictionary (AdsConnection)

Advantage DataTypes conversion in VB 2010

Type

Length

Available in DBF Table

VB 2010 Value

Character
1 to 65530
Yes
4
CICharacter
1 to 65530
No
20
Date
4
Yes
3
Logical
1
Yes
1
Memo
9
Yes
5
Double
8
VFP, Extended
10
Integer
4
VFP, Extended
11
Numeric
2 to 32
Yes
2
Image
9
Extended
7
Binary
9
Extended
6
ShortInteger
2
No
12
Time
4
No
13
TimeStamp
8
No
14
AutoIncrement
4
No
15
Raw
1 to 65530
No
16
CurDouble
8
No
17
Money
8
No
18
ModTime
8
No
22
RowVersion
8
No
21

Best Use, For example :
When you try to Retrieve Advantage Data Dictionary Table Structure you will get column names, and you will may need to retrieve Data Types [Field_Type], Advantage Data Arc. provides System.Columns Field_Type column within the System.Columns Table that return values like [Character], now when you do that in Visual Basic 2010 or any Visual Basic .Net version, you will not get [Character] but you will get [4] instead and you will want to convert it into [Character] name, you can do that using a function or a Select Case expression in VB 2010.
So, in order to retrieve Field_Type or DataType of a certain column in Advantage Database, you may use this code:

Some Exceptions and Errors noticed :

Error : 
Table doesn't appear in the Data Dictionary [ARC.exe] but though it appears in the Data Dictionary Folder.
Description :
When you try to create a free Table [ADT Table] using Sql Statement from VB 2010 like this. The result will be a free Table but not included in the Data Dictionary, but you will only see it in the Folder contains the Database.
Cause :
The User Id section in the connectionString is Empty, but if you tried to create another table with the same name you will get an Error specifying that ISAM found a table with the same name "Table already exists" though it doesn't appear in the Data Dictionary.
Solution :
Provider a User ID or a User Id and Password if possible in the connectionString Whether you are using OleDBConnection or AdsConnection to work with this Data Dictionary.

Here are some online Visual Basic lessons and courses :

Visual Basic Courses - Share