Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Conversion type error

Posted on 2011-03-04
7
Medium Priority
?
322 Views
Last Modified: 2012-06-27
Greetings Experts,
Not sure where I went wrong here. I thought my code was pretty solid. My records are adding to my collection but they are not displaying on my main form.  I get my catch error on line 107 (frmMain)
and lines 120 & 120 (frmMain)are givine me conversion type errors..

Conversion from string "" to type 'Integer' is not valid.
Conversion from string "" to type 'Decimal' is not valid.

Yet im not converting either they were declared respectivly in their classes as INteger and decimal.
PLease advise
classes and forms attached  
CustomerClass.txt
PersonClass.txt
PreferredCustomerClass.txt
CustomerInformationModule.txt
frmAdd.txt
frmMain.txt
0
Comment
Question by:plusone3055
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 22

Expert Comment

by:Thomasian
ID: 35042010
    Private Sub DisplayData(ByVal pc As PreferredCustomer)
        pc.Address = txtAddress.Text
        pc.City = txtCity.Text
        pc.CustomerID = CInt(txtCustNumber.Text)
        pc.Comments = txtComments.Text
        'pc.DiscountLevel = txtpercent.Text
        pc.FirstName = txtFirstName.Text
        pc.LastName = txtLastName.Text
        pc.Phone = txtPhone.Text
        pc.PurchaseAmount = CDec(txtPurchase.Text)
        pc.State = txtState.Text
        pc.Zip = txtZip.Text
    End Sub

Open in new window

Since the sub is named "DisplayData", I believe you want to show the data in the textbox. If so, that should be
        txtAddress.Text = pc.Address
        txtCity.Text = pc.City
        etc...

Open in new window

0
 
LVL 48

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 35042016
What is the value of txtCustNumber.Text when the error occurs?
0
 
LVL 13

Expert Comment

by:LIONKING
ID: 35043606
I think Thomasian has a good point... If you want to display data you should be getting the data from your PreferredCustomer class and displaying it in the textboxes.
Try that out and let us know.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 22

Author Comment

by:plusone3055
ID: 35043968
i reversed it and then it says

Colleciton index must be in the range 1 to the size of hte colleciton

the value i used was 1001

 also when i reversed that
it autogenreated  
txtcustnumber.text = CStr(pc.customerID)
0
 
LVL 22

Accepted Solution

by:
plusone3055 earned 0 total points
ID: 35044764
Public Property CustomerID() As String
        Get
            Return strCustomerNumer
        End Get
        Set(ByVal value As String)
            strCustomerNumer = value
        End Set
    End Property
0
 
LVL 22

Expert Comment

by:Thomasian
ID: 35046308
>>Colleciton index must be in the range 1 to the size of hte colleciton
On which code did the error point to?
0
 
LVL 22

Author Closing Comment

by:plusone3055
ID: 35107028
changed from interer to string
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question