473,569 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I'm looking for a way to create a lookup textbox using VISUAL BASIC 2008

2 New Member
I am a beginner at programming no classes it's sel study with e-books but hey everyone gets stuck. . . I have a snippet of code that I need someone to revise and if possible advice on sorting out my problem, I created a textbox to lookup values in my DB but for sum reason it does'nt matter what I type I seem to get the same value everytime. . . . .Fly by the code and see if anyone could help.

Private m_cnADONetConne ction As New OleDb.OleDbConn ection()
Private m_daDataAdapter As OleDb.OleDbData Adapter
Private m_cbCommandBuil der As OleDb.OleDbComm andBuilder
Private m_dtCD As New DataTable
Dim m_rowPosition As Integer = 0

Private Sub StockDetailsFor m_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Load
m_cnADONetConne ction.Connectio nString = _
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\TEST. mdb"

m_cnADONetConne ction.Open()

m_daDataAdapter = New OleDb.OleDbData Adapter("Select * From CD", m_cnADONetConne ction)
m_cbCommandBuil der = New OleDb.OleDbComm andBuilder(m_da DataAdapter)
m_daDataAdapter .Fill(m_dtCD)


Public Sub StockCheck()

StockEdit_Open_ Conn()
Dim sql = "SELECT CouplingCode ,AlbumTitle ,ReleaseDate ,TotalSongs ,PPD FROM CD WHERE CouplingCode='" & StockDetailsFor m.txtSearch.Tex t & "'"
Dim cmd As New System.Data.Ole Db.OleDbCommand

cmd = New OleDbCommand(sq l, m_cnADONetConne ction)
Dim exReader As OleDbDataReader = cmd.ExecuteRead er
m_cbCommandBuil der = New OleDb.OleDbComm andBuilder(m_da DataAdapter)


Private Sub txtSearch_Leave (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles txtSearch.Leave

Try
If exReader.Read = False Then
MessageBox.Show ("Stock Item does not exist", "Stock Item Error", MessageBoxButto ns.OK, MessageBoxIcon. Stop)
m_cnADONetConne ction.Close()
m_cnADONetConne ction.Dispose()
Else
StockDetailsFor m.CouplingCodeI D.Text = _
m_dtCD.Rows(m_r owPosition)("Co uplingCode").To String()
StockDetailsFor m.txtAlbumName. Text = _
m_dtCD.Rows(m_r owPosition)("Al bumTitle").ToSt ring()
StockDetailsFor m.txtPPD.Text = _
m_dtCD.Rows(m_r owPosition)("PP D").ToString ()
StockDetailsFor m.txtTotalSongs .Text = _
m_dtCD.Rows(m_r owPosition)("To talSongs").ToSt ring()
StockDetailsFor m.dtpReleaseDat e.Text = _
m_dtCD.Rows(m_r owPosition)("Re leaseDate").ToS tring()
StockDetailsFor m.txtQtyHand.Te xt = _
m_dtCD.Rows(m_r owPosition)("Qt yOnHand").ToStr ing()
End If
End Sub
Jan 16 '10 #1
1 1596
vb5prgrmr
305 Recognized Expert Contributor
wrong forum... this forum is pre .net tech, i.e. classic visual basic, you need .net...
Jan 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2570
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am looking for a robust solution for a major application. Almost every developer seems to come up with a completely different solution. While many of them...
8
2491
by: gumi | last post by:
Hi, I am looking for code for a alarm clock program that pops up a messege to be used as part of my VB.Net class project. Any help is very much appreciated. Thanks
1
6390
by: Nick | last post by:
Hi Has anyone encountered the "readonly" issue with Microsoft Forms 2.0 TextBox ? The locked property of the control seems to have no effect - always enabled regardless of whether it's set to True or False. It has some really nice properties and Im using it in my project. I managed to google a post of someone having the same problem, but...
1
3108
by: Polaris | last post by:
Hi: Where is the "Error Lookup" in Visual Studio 2008? Thanks in advance! Polaris
3
2125
by: Saucer Man | last post by:
Is this only available as part of Visual Studio or can it be purchased separately? -- Thanks!
6
2889
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>' Width="30px" ToolTip='<%# Eval("M1") %>'></asp:TextBox>
7
1430
by: =?Utf-8?B?dmlubw==?= | last post by:
Hello, I am creating a VB 2008 application and i would like to create a plan. I try with Graphics of GDI but it doesn't work how i wish. Each wall and window of my plan is a Graphic but Graphic is not an object and then i cannot work on (move, delete). Is there an other method wich is better to do this or may be i have to create work with...
11
2925
by: =?Utf-8?B?UGV0ZXIgSw==?= | last post by:
I am working with Visual Studio or alternately with Expression Web. I need to create about 50 aspx pages with about 1200 thumbnali images, typically arranged in three to four groups per page, having hyperlinks to the corresponding full size images. Can anybody point me to locations in MSDN or elsewhere giving the references to attach, the...
6
3725
by: Tom P. | last post by:
I'm trying to make one of our perennial favorites - The Syntax Color Editor. (Mostly as a learning exercise). I'm wondering if there is a way to capture the Paint event of a textbox so I can render the text myself. I've tried to replicate the functionality of a textbox, but I think it would be easier to simply take over the painting of a...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.