I'm receiving the same warning, and although this has been brought up
several times by other posters, I can't find the solution anywhere. I've
Googled and searched the newsgroups, but I'm at a loss as to the solution.
I create my own structure, then use it when I read from a file, but get the
warning each and every time I do so.
Structure addressEntry
<VBFixedString(ciSalesperson)> Public sSalesperson As String
<VBFixedString(ciBillingAddress1)> Public sBillingAddress1 As String
<VBFixedString(ciBillingAddress2)> Public sBillingAddress2 As String
<VBFixedString(ciBillingAddress3)> Public sBillingAddress3 As String
<VBFixedString(ciShippingAddress1)> Public sShippingAddress1 As String
<VBFixedString(ciShippingAddress2)> Public sShippingAddress2 As String
<VBFixedString(ciShippingAddress3)> Public sShippingAddress3 As String
End Structure
.. . .
Private Sub LoadAddress()
If Not Blank(comboboxBillToLine1.Text) Then
Dim Address As New addressEntry
Dim f As Integer = FreeFile()
FileOpen(f, sDataDirectory & "\address.dat", OpenMode.Random, , ,
Len(Address))
For l As Long = 1 To (LOF(1) \ Len(Address))
FileGet(f, Address, l)
If comboboxBillToLine1.Text.TrimEnd.ToLower =
Address.sBillingAddress1.TrimEnd.ToLower Then
textboxBillToLine2.Text = Address.sBillingAddress2.TrimEnd
textboxBillToLine3.Text = Address.sBillingAddress3.TrimEnd
textboxShipToLine1.Text = Address.sShippingAddress1.TrimEnd
textboxShipToLine2.Text = Address.sShippingAddress2.TrimEnd
textboxShipToLine3.Text = Address.sShippingAddress3.TrimEnd
textboxSalesperson.Text = Address.sSalesperson.TrimEnd
Exit For
End If
Next
FileClose(f)
End If
End Sub
"Tom McL." <tb***@cwnet.com> wrote in message
news:e8**************@TK2MSFTNGP11.phx.gbl...
I'm trying to move a program that was designed using Visual Studio 2003
and
(Visual Basic) into Visual Studio 2005. When it runs I get the following
warning in the
Error List Window and I'm not sure how to correct it. The program runs
fine
except for the warning. The warning puts a green squiggle line under
MyRecord
in the (Private Sub GetRecord()).
Warning Message:
Implicit conversion from 'System.ValueType' to
'MyProgram.mMyModule.Record'
in copying the value of 'ByRef' parameter 'Value' back to the matching
argument.
C:\Documents and Settings\Tom\My Documents\Visual Studio 2005\Projects\
MyProgram\fMyForm.vb 3700 34 MyProgram
Module level declare:
Public Structure Record
<VBFixedString(8)> Public filename As String
Public RainData(,) As Single
Public SnowData(,) As Single
Public SeasonToDateData(,) As Single
End Structure
Public myRecord As Record
End Module
Public Class fMyForm
Private Sub GetRecord()
Dim filenum As Short
Dim sFileName As String
'open file file and get record
sFileName = ListBoxFiles.Items.Item(1).ToString
filenum = FreeFile()
Try
FileOpen(filenum, Application.StartupPath & "/" &
sFileName, _
OpenMode.Random, OpenAccess.Read, OpenShare.Shared,
pRecLength)
FileGet(filenum, myRecord)
FileClose(filenum)
Catch ex As Exception
MsgBox(ex.ToString) ' Show friendly error message.
Finally
End Try
End Sub
End Class
Thanks
Tom