hi there..
step by step:
Code:
If sTitle Or sArtist Or sAlbum Or sGenre Or sLength Or sKey = "" Then
you are trying to compare every string with ""?? if that is the case,
vb doesn't handle the if this way (in fact I think that any language do that this way)...
you have to compare every string with = "" something like this:
Code:
If sTitle = "" Or sArtist = "" Or sAlbum = "" Or = "" sGenre = "" Or sLength = "" Or sKey = "" Then
the error is telling you that it can't convert the strings to boolean (because OR compares boolean values ;) )
your second problem is easily solved if you have option explicit set to on...
since ValidateInput is a function, you cannot assign a value to it (you are doing that when:
Code:
ValidateInput = False
)
you have two ways to do this:
1. Store the returned value of this function in a new variable (maybe ReturnedValue) and then do the if...
2. write the if with the function (ugly to see, but the same result)
Examples:
1.
Code:
dim ReturnedValue as boolean
returnedvalue = ValidateInput(txtTitle.Text, txtArt.Text, txtAlb.Text, txtGen.Text, txtLen.Text, txtKey.Text)
If returnedValue Then
AddToGrid(txtTitle.Text, txtArt.Text, txtAlb.Text, txtGen.Text, txtLen.Text, txtKey.Text)
Else
Exit Sub 'this is because if ValidateInput returns false it already handled within the function
End If
2.
Code:
if ValidateInput(txtTitle.Text, txtArt.Text, txtAlb.Text, txtGen.Text, txtLen.Text, txtKey.Text) Then
AddToGrid(txtTitle.Text, txtArt.Text, txtAlb.Text, txtGen.Text, txtLen.Text, txtKey.Text)
Else
Exit Sub 'this is because if ValidateInput returns false it already handled within the function
End If
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========