Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Returning data to from in Visual Basic?

I am having some trouble returning code to my form in visual basic. It is sent to a class where it is validated and then is returned to the form but i am not sure how exactly to do that and answers seem to be hard to find. Here is the code the ??? marks represent where the problem is.

Thanks in advance for any help :).

Private Function IsValidData() As Boolean

Return Validator.IsValidLength(???) AndAlso Validator.IsValidCharacters(???)

End Function

Here is the validation class:

Public Class Validator

Public Shared Function IsValidLength(ByVal mynum As numbers) As Boolean

If mynum.Ppartnumber.Length = 6 Then

Return True

Else 'If mynum.Ppartnumber.Length <> 6 Then

Return False

End If

End Function

Public Shared Function IsValidCharacters(ByVal mynum2 As numbers) As Boolean

If IsNumeric(Right$(mynum2.Ppartnumber, 4)) Then

Return True

Else

Return False

End If

If Not IsNumeric(Left$(mynum2.Ppartnumber, 2)) Then

Return True

Else

Return False

End If

End Function

End Class

Update:

I already have a class that holds the values to be checked. It is here:

Public Class numbers

Private strpartnumber As String

Private strpartname As String

Private intinventorybalance As String

Public Sub New()

Debug.WriteLine("Object created")

strpartnumber = String.Empty

strpartname = String.Empty

intinventorybalance = 0

End Sub

Public Property Ppartnumber() As String

Get

Return strpartnumber

End Get

Set(ByVal value As String)

strpartnumber = value

End Set

End Property

Public Property Ppartname() As String

Get

Return strpartname

End Get

Set(ByVal value As String)

strpartname = value

End Set

End Property

Public Property Pinventorybalance() As String

Get

Return intinventorybalance

End Get

Set(ByVal value As String)

intinventorybalance = value

End

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    You can't return multiple values that way. Also I think you'll find that your IsValidCharacters Function is not going to work the way you think it is. The first IF statement is alwasy going to return a value, the 2nd IF statement will never be evaluated. You'll want to fix that.

    As far as returning multiple values from a formula, build a class that holds the multiple values and return the class after loading it with the required values.

    Source(s): VB.NET Programmer
  • ?
    Lv 4
    4 years ago

    for the reason which you're dealing with automobiles i can anticipate your on line organization is employing place of work professional. Open get right of entry to, create a database, import each and all the information. in the past that, you are able to desire to consolidate each and all the information into one sheet. If the rows are too many ie >65000 rows, then you definately import the information one sheet at a time. you presently have the comprehensive record in get right of entry to. employing trouble-free question, extract out each and all the Ford and Mustangs. Export it back to Excel. the stairs are less demanding.

Still have questions? Get your answers by asking now.