Connecting Tech Pros Worldwide Forums | Help | Site Map

Visual Studio 2005 - Warning in the Error List Window

Tom McL.
Guest
 
Posts: n/a
#1: Dec 13 '05
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



Cesar Ronchese
Guest
 
Posts: n/a
#2: Dec 13 '05

re: Visual Studio 2005 - Warning in the Error List Window


You double-clicked the green-underlined message so VS can show the error
line? If no, do it and post the block of code, please. I think the code you
posted is not that one it cause the message.

[]
Cesar


"Tom McL." <tbmcl@cwnet.com> wrote in message
news:e8PGHI4$FHA.1600@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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
>[/color]


Tom McL.
Guest
 
Posts: n/a
#3: Dec 13 '05

re: Visual Studio 2005 - Warning in the Error List Window


Cesar,


This is the warning message I get when I hover over the
green-underlined variable:

Implicit conversion from 'System.ValueType' to 'MyProgram.mMyModule.Record'
in copying the value of 'ByRef' parameter 'Value' back to the matching
argument.

And it is the same message I see when I open the Error List Window.

The first block of code is my Module level declare of the structure named
Record.

Module level declare:
Public Structure Record
<VBFixedString> Public filename As String
Public RainData(,) As Single
Public SnowData(,) As Single
Public SeasonToDateData(,) As Single
End Structure

Public myRecord As Record
End Module


The second block is from my Public Class fMyForm.
The green-underlined variable is "myRecord" in "FileGet(filenum, myRecord)".
I hope
this is what you need.



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




Cesar Ronchese
Guest
 
Posts: n/a
#4: Dec 13 '05

re: Visual Studio 2005 - Warning in the Error List Window


I need the FileGet( ) signature, I'm looking for the ByRef and ByVal tip.
You tried change all the parameters of that function to ByVal to see if it
works?




"Tom McL." <tbmcl@cwnet.com> wrote in message
news:Odm0p9$$FHA.2256@TK2MSFTNGP11.phx.gbl...[color=blue]
> Cesar,
>
>
> This is the warning message I get when I hover over the
> green-underlined variable:
>
> Implicit conversion from 'System.ValueType' to
> 'MyProgram.mMyModule.Record'
> in copying the value of 'ByRef' parameter 'Value' back to the matching
> argument.
>
> And it is the same message I see when I open the Error List Window.
>
> The first block of code is my Module level declare of the structure named
> Record.
>
> Module level declare:
> Public Structure Record
> <VBFixedString> Public filename As String
> Public RainData(,) As Single
> Public SnowData(,) As Single
> Public SeasonToDateData(,) As Single
> End Structure
>
> Public myRecord As Record
> End Module
>
>
> The second block is from my Public Class fMyForm.
> The green-underlined variable is "myRecord" in "FileGet(filenum,
> myRecord)". I hope
> this is what you need.
>
>
>
> 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
>
>
>
>[/color]


Tom McL.
Guest
 
Posts: n/a
#5: Dec 14 '05

re: Visual Studio 2005 - Warning in the Error List Window


Cesar,

Far as I can tell FileGet() will not except anything but byRef.


Cesar Ronchese
Guest
 
Posts: n/a
#6: Dec 14 '05

re: Visual Studio 2005 - Warning in the Error List Window


Can you build a sample (some pieces of code) and post a link here? This
sample need to have that mencioned issue, so we can simulate the error and
try discover the cause.

[]s
Cesar


"Tom McL." <tbmcl@cwnet.com> wrote in message
news:uQ7xb%23FAGHA.2036@TK2MSFTNGP14.phx.gbl...[color=blue]
> Cesar,
>
> Far as I can tell FileGet() will not except anything but byRef.
>[/color]


strchild
Guest
 
Posts: n/a
#7: Apr 21 '06

re: Visual Studio 2005 - Warning in the Error List Window


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." <tbmcl@cwnet.com> wrote in message
news:e8PGHI4$FHA.1600@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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
>[/color]


Closed Thread