Search VB 2010

Showing posts with label Optimization. Show all posts
Showing posts with label Optimization. Show all posts

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 :

Wednesday, June 19, 2013

Visual Basic Online Course Search Optimization

dtSearch Engine
Using dtSearch Engine to Create Search Optimization via Visual Basic 2010

Create Visual Basic .Net Search Optimization tool using dtSearch Engine to :

 Optimize Search
Index files
Search Index
Retrieve Search Results
Highlight Search Results
dtSearch Engine : Powerful tool can be downloaded from its official website. There is the dtDeskTop Search and dtSearch Engine for developers, we need the last one to be downloaded. You will be given a password to install the Eval. Version of dtSearch Engine by the customer support team via Email or via SkyPe. I recommend downloading the dtSearch Engine 772.

After installing dtSearch Engine successfully on your machine, you will find the files in the C:\ drive and Start Menu. Restart your machine.
Search Optimization
dtSearch Engine - installed files
There will be VB.Net examples in the C:\ drive cover most of the supported programming languages by the dtSearch Engine Tool including VB.Net 2010 [.Net frameWork 4] in this folder (C:\Program Files\dtSearch Developer\examples\vb.net4).

dtSearch Engine mechanism goes like this :

  • Create Indexes (If exists, then you can update the existing Index)
  • Add Files to be Indexed
  • Search Index
  • Retrieve Search Results (Highlight search results)

From Visual Basic .Net 2010

In order to use dtSearch Engine within VB2010 you will need :
      1. Create new Visual Basic 2010 Project
      2. Add dtSearch Engine Reference Files.
dtSearch Engine Reference Files to be added to the VB2010 project, are :
dtSearch Engine Optimization via Visual Basic .Net
dtSearch Engine via Visual Basic .Net (framework 4.0)
Not only searching System Files but also you can Search Database using the same mechanism (Create Index, Add Resources to Index, Search Indexed Resources, .... ,etc.)
Here is a source code example well detailed and explained of How to use dtSearch Engine to Optimize Search "Optimization" via VB.Net 2010 and .Net framework 4.0.

Using dtSearch Engine in Visual Basic .Net 2010 [Source Code Example] :
(1) dtSearch Engine - Logic and Design
(2) dtSearch Engine - Indexing/Searching local Files

Here are some online Visual Basic lessons and courses :

Wednesday, June 12, 2013

Visual Basic Online Course - The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine

The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine

MS-Access 2010 for VB 2010
MS-Access 2010 for VB 2010
Visual Basic 2010 Error Message :
InvalidOperationException was unhandled
" The Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine" ?
This error message means that the machine [Computer, Laptop] that you are trying to run your application on, doesn't have MS-Access 2007 installed, or not installed properly. Some developers just pack their applications and send it to the client :
- relying on - that the client have MS-Office 2007/2010 installed already and won't never crash or updated to 2010, 
- or they just did not include the proper component along with their package, 
- or even worse they may not know what exactly should they do to make it work on the client's machine.

╚Ž╣ To get this error message to go away, you need to include this file in your package :

2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies

 Some think that Office 2007 should be installed on a client's machine in order for the application to run clean or properly with any bugs, No, you can include this tool for both [Win32 and Win64] and don't count the client to have Office installed or not.

Get the file from here [AccessDatabaseEngine] for both Win64bit and Win32bit, available in all languages supported by Microsoft. Here are some information about downloading and installing the tool :

When you first click on Download on the Download page, you will see :

Choose the download you want

File Name

AccessDatabaseEngine.exe    25.6 MB
AccessDatabaseEngine_x64.exe    28.1 MB

The download should start for selected file ...
Office

Thank you for downloading

The 2007 Microsoft Office system Primary Interop Assemblies (PIA) redistributable is a Microsoft Windows Installer package that contains the Primary Interop Assemblies for 2007 Microsoft Office system products.

 You could see a reference to Office 2010, don't panic, this is the same, it's the same tool that supports also Office 2010. If your application relies on MS-Access 2010 Database and you got the same meaningful Error message then the same cause needs to be fixed by including this very same file into your package without relying on the client's machine to have MS-Office 2010 or MS-Access 2010 installed on it.

Thank you for downloading

  • Microsoft Access Database Engine 2010 Redistributable

    After the download finishes, pick up the corresponding file that meets your OS kind [32 or 64]

    ♥ Installation Instructions ♥

    To install this download:
    1. Download the file by clicking the Download button and saving the file to your hard disk.
    2. Double-click the AccessDatabaseEngine.exe program file on your hard disk to start the setup program.
    3. Follow the instructions on the screen to complete the installation.
    To use this download:
    1. If you are the user of an application, consult your application documentation for details on how to use the appropriate driver.
    2. If you are an application developer using OLEDB, set the Provider argument of the ConnectionString property to “Microsoft.ACE.OLEDB.12.0”

      If you are connecting to Microsoft Office Excel data, add the appropriate Extended Properties of the OLEDB connection string based on the Excel file type:

      File Type (extension)                                             Extended Properties
      ---------------------------------------------------------------------------------------------
      Excel 97-2003 Workbook (.xls)                                  "Excel 8.0"
      Excel 2007-2010 Workbook (.xlsx)                             "Excel 12.0 Xml"
      Excel 2007-2010 Macro-enabled workbook (.xlsm)      "Excel 12.0 Macro"
      Excel 2007-2010 Non-XML binary workbook (.xlsb)      "Excel 12.0"

    3. If you are an application developer using ODBC to connect to Microsoft Office Access data, set the Connection String to “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path to mdb/accdb file”
    4. If you are an application developer using ODBC to connect to Microsoft Office Excel data, set the Connection String to “Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=path to xls/xlsx/xlsm/xlsb file”
    To remove this download:
    To remove the download file itself, delete the file AccessDatabaseEngine.exe
    1. On the Start menu, point to Settings and then click Control Panel.
    2. Double-click Add/Remove Programs.
    3. In the list of currently installed programs, select “Microsoft Access database engine 2010” and then click Remove or Add/Remove. If a dialog box appears, follow the instructions to remove the program.
    4. Click Yes or OK to confirm that you want to remove the program.  

     

    Additional Information


      This package contains components that are at the same version as the “The 2007 Microsoft Office Suite Service Pack 1 (SP1)” release.

      The Office System Drivers are only supported under certain scenarios, including:

      1. Desktop applications which read from and write to various files formats including Microsoft Office Access, Microsoft Office Excel and text files.
      2. To transfer data between supported file formats and a database repository, such as SQL Server. For example, to transfer data from an Excel workbook into SQL Server using the SQL Server Import and Export Wizard or SQL Server Integration Services (provided the SSIS jobs run in the context of a logged-on user with a valid HKEY_CURRENT_USER registry hive).
 Source for Installation instruction (Microsoft)

Here are some online Visual Basic lessons and courses :

Monday, May 16, 2011

VB 2010 Create Controls at Run-Time with events

How to Create Controls at Run-Time in 

VB 2010

VB 2010 Create controls at run-time
Visual Basic Online Course

Logic

The example will show you how to create a control (TextBox) at the Application Run-Time. This TextBox will allow only Numbers. We will create a new TextBox control with event  Text Changed when the form is clicked

Project Design

Create new VB 2010 Windows Application Project (MyPro), don't forget to always Save your project

How does it work

You RUN your project and then click on the Form (Form1) and then you will notice that a TextBox control was created with the same properties that we provided in our example in the code below.

TextBox Properties

Location : The cursor location when click on the Form1
Size : 120,300
Parent : Form1 (Me)
TextAlign : HorizontalAlignment.Left
ForeColor : Color.White
Name : MyNewText
Font : Times New Roman, 10, Regular, Point

Code

Thank you for reading ....

Here are some online Visual Basic lessons and courses :

Visual Basic Courses - Share