473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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(Ds1)
Case "Studio"
daStudio.Fill(Ds1)
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 BindingManagerBase

Private Sub frmBrowseMovies_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
objData = New VideoData
dsMovies = objData.getMovies("Video")
bmMovies = Me.BindingContext(dsMovies, "Video")
bindData()
AddHandler bmMovies.PositionChanged, AddressOf Position_Changed
Position_Changed(sender, e)
Catch ex As Exception
End Try
End Sub

Sub bindData()
txtMovieID.DataBindings.Add("Text", dsMovies, "Video.MovieID")
txtTitle.DataBindings.Add("Text", dsMovies, "Video.Title")
txtDirector.DataBindings.Add("Text", dsMovies, "Video.Director")
txtActor.DataBindings.Add("Text", dsMovies, "Video.Actor")
txtActress.DataBindings.Add("Text", dsMovies, "Video.Actress")
txtLength.DataBindings.Add("Text", dsMovies, "Video.Length")
txtPopularity.DataBindings.Add("Text", dsMovies, "Video.Popularity")
txtYear.DataBindings.Add("Text", dsMovies, "Video.Year")
txtCategory.DataBindings.Add("Text", dsMovies, "Video.Category")
txtStudioID.DataBindings.Add("Text", dsMovies, "Video.StudioID")
chkAward.DataBindings.Add("checked", dsMovies, "Video.Awards")
End Sub

Private Sub Position_Changed(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(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

If btnAdd.Text = "Add" Then

unlockTextBoxes()
disableNavigation()
setEditButtons()
bmMovies.EndCurrentEdit()
bmMovies.AddNew()
txtMovieID.Focus()

Else

bmMovies.CancelCurrentEdit()
lockTextBoxes()
enableNavigation()
resetEditButtons()

End If

End Sub
Oct 24 '06 #1
0 1265

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

Similar topics

77
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...
16
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...
7
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,...
1
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...
1
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...
10
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...
23
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:...
4
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...
4
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.