Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete
Text Box Auto Complete Text Box Auto Complete
Text Box Auto Complete
Go Back  Xtreme Visual Basic Talk > > > Text Box Auto Complete


Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2013, 09:53 AM
sirmilt sirmilt is offline
Contributor
 
Join Date: Jan 2003
Location: Florida
Posts: 451
Default Text Box Auto Complete


I am using Visual Basic 2010 and trying to set several of the Text Box Auto Complete properties to allow me to have a small number of items that I want included and which will be added to from entry by the User. The "AutoComplete Custom Source" property works fine with a pre-designed list. However, I want allow the user to either capture from the list or enter a different value and if the user adds a value not listed, I want to save that value to the list. (I seem to have repeated myself)

I know that I can create a list using a simple query in the database which works fine but I cant seed the result with the several known and constant items. I hope that my explanation covers the situation

Can anyone suggest a way to do this?
Reply With Quote
  #2  
Old 08-28-2013, 10:07 AM
DrPunk's Avatar
DrPunkText Box Auto Complete DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

Quote:
Originally Posted by sirmilt View Post
I know that I can create a list using a simple query in the database which works fine but I cant seed the result with the several known and constant items. I hope that my explanation covers the situation
I'm not sure what you mean by this. If you queried the list from a database to say a DataTable then it is easy to add whatever else you wanted to that DataTable.
Code:
Dim dt as DataTable
dim dr as DataRow

' Refresh the datatable from the database, pretend I've declared all the dataadapters and commands and everything.
da.Fill(dt)

' Then start adding your own stuff to the datatable
dr = dt.NewRow
dr.Item("somefield") = Whatever
dt.Rows.Add(dr)
__________________
There are no computers in heaven!
Reply With Quote
  #3  
Old 08-28-2013, 10:33 AM
sirmilt sirmilt is offline
Contributor
 
Join Date: Jan 2003
Location: Florida
Posts: 451
Default

Thank you for the speedy response, perhaps this will help to determine what I'm trying to do.

I use the following stored procedure to fill the values in a Text Box Auto Complete mode:
.SQL = "SELECT DISTINCT [Authors] FROM(tblBooks) WHERE(Authors <> "") ORDER BY [Series];"

This works fine if there are any books recorded in tblBooks, however, if there are no previous entries there is nothing to select and nothing for the AutoComplete mode to work on. I want to correct this and give a new User a pre-selected list of items to select from.

Milt
Reply With Quote
  #4  
Old 08-29-2013, 02:09 AM
DrPunk's Avatar
DrPunkText Box Auto Complete DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

In that case, after running the SQL query you check if anything is returned, and if not you start putting your own stuff in the datasource.

Code:
da.Fill(dt)

if dt.Rows.Count = 0 Then
    ' Start putting your pre-selected list of items in the datasource
    dr = dt.newrow
    etc.
endif
__________________
There are no computers in heaven!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete Text Box Auto Complete
Text Box Auto Complete
Text Box Auto Complete
 
Text Box Auto Complete
Text Box Auto Complete
 
-->