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

Home Posts Topics Members FAQ

Data tier problem with .addNew() won't clear text boxes.

2 New Member
Working on this piece of code but when i click on my add button in the form the text boxes that i am using do not clear and so i can't add a new record any help
would be great. The code for my data tier and app is below thanks.

Data tier

Public Class VideoData
Public Function getMovies(ByVal strName As String) As DataSet
Select Case strName
Case "Video"
daMovies.Fill(D s1)
Case "Studio"
daStudio.Fill(D s1)
End Select
Return Ds1
End Function

Public Sub upDateAll(ByVal ds As DataSet, ByVal strName As String)

Try
Select Case strName
Case "Video"
daMovies.Update (ds)
Case "Studio"
daStudio.Update (ds)
End Select
Catch
Throw
End Try
End Sub

End Class

Application

Public Class frmBrowseMovies
Inherits System.Windows. Forms.Form

Dim objData As VideoData
Dim dsMovies As DataSet
Dim bmMovies As BindingManagerB ase

Private Sub frmBrowseMovies _Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Try
objData = New VideoData
dsMovies = objData.getMovi es("Video")
bmMovies = Me.BindingConte xt(dsMovies, "Video")
bindData()
AddHandler bmMovies.Positi onChanged, AddressOf Position_Change d
Position_Change d(sender, e)
Catch ex As Exception
End Try
End Sub

Sub bindData()
txtMovieID.Data Bindings.Add("T ext", dsMovies, "Video.MovieID" )
txtTitle.DataBi ndings.Add("Tex t", dsMovies, "Video.Titl e")
txtDirector.Dat aBindings.Add(" Text", dsMovies, "Video.Director ")
txtActor.DataBi ndings.Add("Tex t", dsMovies, "Video.Acto r")
txtActress.Data Bindings.Add("T ext", dsMovies, "Video.Actress" )
txtLength.DataB indings.Add("Te xt", dsMovies, "Video.Leng th")
txtPopularity.D ataBindings.Add ("Text", dsMovies, "Video.Populari ty")
txtYear.DataBin dings.Add("Text ", dsMovies, "Video.Year ")
txtCategory.Dat aBindings.Add(" Text", dsMovies, "Video.Category ")
txtStudioID.Dat aBindings.Add(" Text", dsMovies, "Video.StudioID ")
chkAward.DataBi ndings.Add("che cked", dsMovies, "Video.Awar ds")
End Sub

Private Sub Position_Change d(ByVal sender As Object, ByVal e As EventArgs)
With bmMovies
lblRecord.Text = "Record " & (.Position + 1) & " of " & .Count
End With
End Sub

Private Sub btnAdd_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles btnAdd.Click

If btnAdd.Text = "Add" Then

unlockTextBoxes ()
disableNavigati on()
setEditButtons( )
bmMovies.EndCur rentEdit()
bmMovies.AddNew ()
txtMovieID.Focu s()

Else

bmMovies.Cancel CurrentEdit()
lockTextBoxes()
enableNavigatio n()
resetEditButton s()

End If

End Sub
Oct 24 '06 #1
0 1282

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

Similar topics

77
5650
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a database from SQL Server to Oracle or DB2 or vice versa... and that's it.... And a lot of these enterprises don't need it as they already know what...
16
2994
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
7
2339
by: Aravind | last post by:
Hi folks. I have 2 forms, frmBorrow and frmHistory frmBorrow has an unbound multi-column combo box (cboMember) and 7 unbound text boxes (MemNo, MemName, MemIC, MemType, CourseFaculty, Borrow, Due) frmHistory has the following text boxes: MemName, Borrow, Due
1
1561
by: HS1 | last post by:
Hello all - I have a master and a details table presented in two datagrid - I also have some text boxes that present the values from any record in the master table. This also helps to enter new data for the master table. I also have a Add button to add new data Me.BindingContext(masterGrid.DataSource, "masterTable").AddNew()
1
1336
by: Aparna Rege | last post by:
Hi, I am having trouble with a tab control. All the fields on the form are data bound and are spread over two tabs of a tab control. I have placed a Clear button with the code to clear all the fields on the form. When I click the Clear button, all the text boxes on the current tab get cleared. But when I go to the other tab, I see data...
10
1655
by: Doug Bell | last post by:
Hi, I have an application that has a "Data Access Class" and "User Interface Class". It is for receiving Purchase Order data from one system and pushing processed transactions to another system. The system generally works quite well. Currently the User interface calls for a refresh of data every 15 minutes (selectable) and the Data...
23
2740
by: dangerd | last post by:
hi there, I used css for a page, it worked but only in IE not in firefox. What DOCTYPE whould I use for firefox. the external stylesheet contains the following: body { background-color: AEB4C0; border-width:thin;
4
2279
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I have created a report. This report needs to display records between two dates entered by the user. I put two text boxes on the report so I can enter the start and end date - I set them to use an input mask of 'short date' format. The problem is that when I enter anything in these text boxes, as soon as the field looses focus, the text is...
4
2606
by: AlexNunley | last post by:
I've adopted a moderately sized (65k records) active use database (Access 2000, Windows XP). One of the most commonly used forms is whats called the RMA generation field, used to add claim information to a table on an item-by-item basis. the form is pretty straight forward, but is in need of updating. In talking with some of the users its been...
0
7698
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
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
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
7673
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
7970
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...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
937
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.