473,395 Members | 1,999 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,395 software developers and data experts.

Cant solve this error.

Me
Hi Folks

I keep recieving the following error message when i try to bind a combobox to the value that is in a textbox. the application crashes on the following line...

Me.CBoxTitle.SelectedItem = frmExistingCustomer.TBTitle.Tex

this is the error mesaage i recieve
An unhandled exception of type 'System.NullReferenceException' occurred in Caravan.ex
Additional information: Object reference not set to an instance of an object

any help is appreciated
Nov 22 '05 #1
3 1481
CT
Can't really say exactly what is wrong, but judging from the error message,
an object hasn't yet been instantiated. Now, in which method are you trying
to do this? Perhaps you're trying to perform this assignment before the
CBoxTitle has been instantiated (such as in the Page_Init event procedure),
or perhaps the frmExistingCustomer isn't loaded?

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Me" <an*******@discussions.microsoft.com> wrote in message
news:5A**********************************@microsof t.com...
Hi Folks,

I keep recieving the following error message when i try to bind a combobox
to the value that is in a textbox. the application crashes on the
following line....

Me.CBoxTitle.SelectedItem = frmExistingCustomer.TBTitle.Text

this is the error mesaage i recieve:
An unhandled exception of type 'System.NullReferenceException' occurred in
Caravan.exe
Additional information: Object reference not set to an instance of an
object.

any help is appreciated

Nov 22 '05 #2
Me
Hi

The error i now recieve is

Cant bind to property or coloumn Title on datacource. Parameter name: datamembe

this message appears when i click the OK button on Form2. The message does not end the application but my binding code does not run
Here is my binding code

Tr
cn.Open(

da.Fill(Guest.dsGuest, "ClientDet"

txtTitle.DataBindings.Clear(
txtForename.DataBindings.Clear(
txtSurname.DataBindings.Clear(
txtaddress.DataBindings.Clear(
txtPostcode.DataBindings.Clear(
txtorganisation.DataBindings.Clear(
txtPhoneNo.DataBindings.Clear(

'display the records in the control
Guest.dsGuest.Tables("ClientDet").Select(
Me.txtTitle.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Title")
Me.txtForename.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Forename")
Me.txtSurname.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "SurName")
Me.txtaddress.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Address")
Me.txtPostcode.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Postcode")
Me.txtorganisation.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "OrgName")
Me.txtPhoneNo.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "PhoneNo")

'place the values from the controls into the global varible
TBTitle = txtTitl
TBPubFName = txtForenam
TBPubLName = txtSurnam
TBPubAddr = txtaddres
TBPubPCode = txtPostcod
TBPubPhoneNo = txtPhoneN
TBPubOrg = txtorganisatio
LabelExClientID = lblExClientI

Me.Close(

i declare the variables at the top of the form like so
Public Shared TBTitle As TextBo
Public Shared TBPubFName As TextBo
Public Shared TBPubLName As TextBo
Public Shared TBPubAddr As TextBo
Public Shared TBPubPCode As TextBo
Public Shared TBPubPhoneNo As TextBo
Public Shared TBPubOrg As TextBo

can anyone plz help
Nov 22 '05 #3
CT
I can't see anything wrong from quickly browsing your code. Which line
throws the exception? In addition, do you have the database schema?

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Me" <an*******@discussions.microsoft.com> wrote in message
news:B1**********************************@microsof t.com...
Hi,

The error i now recieve is:

Cant bind to property or coloumn Title on datacource. Parameter name: datamember
this message appears when i click the OK button on Form2. The message does not end the application but my binding code does not run. Here is my binding code:

Try
cn.Open()

da.Fill(Guest.dsGuest, "ClientDet")

txtTitle.DataBindings.Clear()
txtForename.DataBindings.Clear()
txtSurname.DataBindings.Clear()
txtaddress.DataBindings.Clear()
txtPostcode.DataBindings.Clear()
txtorganisation.DataBindings.Clear()
txtPhoneNo.DataBindings.Clear()

'display the records in the controls
Guest.dsGuest.Tables("ClientDet").Select()
Me.txtTitle.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Title")) Me.txtForename.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Forename")) Me.txtSurname.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "SurName")) Me.txtaddress.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Address")) Me.txtPostcode.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "Postcode")) Me.txtorganisation.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "OrgName")) Me.txtPhoneNo.DataBindings.Add(New Binding("Text", Guest.dsGuest.Tables("ClientDet"), "PhoneNo"))
'place the values from the controls into the global varibles
TBTitle = txtTitle
TBPubFName = txtForename
TBPubLName = txtSurname
TBPubAddr = txtaddress
TBPubPCode = txtPostcode
TBPubPhoneNo = txtPhoneNo
TBPubOrg = txtorganisation
LabelExClientID = lblExClientID

Me.Close()

i declare the variables at the top of the form like so:
Public Shared TBTitle As TextBox
Public Shared TBPubFName As TextBox
Public Shared TBPubLName As TextBox
Public Shared TBPubAddr As TextBox
Public Shared TBPubPCode As TextBox
Public Shared TBPubPhoneNo As TextBox
Public Shared TBPubOrg As TextBox
can anyone plz help

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Me | last post by:
Hi Folks I keep recieving the following error message when i try to bind a combobox to the value that is in a textbox. the application crashes on the following line... Me.CBoxTitle.SelectedItem...
2
by: sonu | last post by:
I am tring to create activexobject like var Fo =new ActiveXObject("Scripting.FileSystemObject"); but i am finding error that automation server cant create object any help
2
by: celtic_kiwi | last post by:
I have an Access 97 database, quite large, and have started getting the error, Error 3048: Can't Open any more databases. -The data is split from the application (front end and back end). -The...
8
by: Mas L via DotNetMonster.com | last post by:
Hi, I have a c++ source code which I can compile to be a DLL (in VS.NET 2003). And I need to use it in a C# program. After I compiled/build the C++ code to a DLL, I add it as a Reference in my...
1
by: t322y | last post by:
Hi All I installed Microsoft.Net Framework Version:1.0.3705.209 (included ASP.NET Version:1.0.3705.0) in my Win 2000 SP3 3 weeks ago. It worked well all until i installed a free softwore GoMono. I...
1
by: otupia | last post by:
Exercise : Given the diagram below. Transform the diagram into C++ program. Class Grade Private members :char letter;float score; Public Members :void SetScore( float );float GetScore(...
0
Sakalicek
by: Sakalicek | last post by:
Hello all, I have serious problem and have no idea how to solve it, of course :) I have Web Service which has master page. This side is the client side. On master page there are some submit...
6
by: WolfgangS | last post by:
Ok first off, i am a total beginner at this groups stuff and i have no clue how this works. This is probabaly the wrong group for my problem but i will post it anyways. Learning by doing right? ...
5
by: lazzypink | last post by:
query = "UPDATE Camera SET CameraName=" + CameraName + " WHERE CameraName=" + oldIPCamera.CameraName; hi guys! can help me solve this problem? why i cant update the new camera name (camera_3) for...
2
by: Mucahit ikiz | last post by:
I cant make a full dynamic query in LINQ I have 2 situation methods (only_exp_query, only_tbl_query) those are working. .... using System.Linq.Dynamic; using System.Data.Linq; .... string...
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: 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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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,...

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.