Register
Tuesday, January 06, 2009
Forum
 
Option Strict errors
Last Post 30 Oct 2008 08:45 PM by Telarian. 3 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
Telarian
New Member
New Member
Posts:33


--
29 Oct 2008 09:54 PM  
I get lots of option strict type errors when I generate. I have, in the past, just altered my templates to fix them. Since I moved to 3.5 I will have to go change the templates again. No big deal, but I'm just wondering if everyone else doesn't have this problem? Do others not use option strict or something? Just curious.

Your thoughts and comments are greatly appreciated.

Thanks,

Tory
eurowise
Basic Member
Basic Member
Posts:107


--
30 Oct 2008 07:00 AM  
Ca you specify where these errors occur and where you have fixed them?

Thanks

Philip
Telarian
New Member
New Member
Posts:33


--
30 Oct 2008 06:16 PM  
Not sure if underlining and such is working in this forum yet so I'm testing.
Telarian
New Member
New Member
Posts:33


--
30 Oct 2008 08:45 PM  
Well I've been trying to figure out the best way to point out the errors.. I think I'll just list file names, line numbers and fixes. Each of them just needs a specific conversion because option strict prohibits implicit conversion.

This is all based on the templates downloaded with 3.5 beta.

WinSearchUserControl.xsl

Just a typo here.
Line 157
Current
<![CDATA['''<summary>Updates the record lable when a selection changes
Fixed
<![CDATA['''<summary>Updates the record label when a selection changes

Here is the real issues.
Line 166
Current
Dim Position As String = <xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1
Fixed
Dim Position As String = CStr(<xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1)

Line 167
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 360
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 444
Current
Dim Position As String = <xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1
Fixed
Dim Position As String = CStr(<xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1)

Line 445
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 454
Current
Dim Position As String = <xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1
Fixed
Dim Position As String = CStr(<xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1)

Line 455
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 464
Current
Dim Position As String = <xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1
Fixed
Dim Position As String = CStr(<xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1)

Line 465
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 473
Current
Dim Position As String = <xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1
Fixed
Dim Position As String = CStr(<xsl:value-of select="$ReadOnlyListName"/>BindingSource.Position + 1)

Line 474
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

I just realized that the summary information on the methods affected by the preceding changes is also wrong. They all say "next record" when they should say "last", "previous", "first" accordingly.
Line 449
Current
<![CDATA['''<summary>Moves to the next record in the search grid
Fixed
<![CDATA['''<summary>Moves to the previous record in the search grid

Line 458
Current
<![CDATA['''<summary>Moves to the next record in the search grid
Fixed
<![CDATA['''<summary>Moves to the first record in the search grid

Line 467
Current
<![CDATA['''<summary>Moves to the next record in the search grid
Fixed
<![CDATA['''<summary>Moves to the last record in the search grid


WinDataEntryUserControl.xsl

Line 303
Current
Dim <xsl:value-of select="@PropertyMapping"/> As <xsl:value-of select="@NetDataType"/> = SearchList.Item(RecordNumber - 1).<xsl:value-of select="@PropertyMapping"/>
Fixed
Dim <xsl:value-of select="@PropertyMapping"/> As <xsl:value-of select="@NetDataType"/> = SearchList.Item(CInt(RecordNumber - 1)).<xsl:value-of select="@PropertyMapping"/>

Line 324
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 336
Current
Dim <xsl:value-of select="@PropertyMapping"/> As <xsl:value-of select="@NetDataType"/> = SearchList.Item(RecordNumber + 1).<xsl:value-of select="@PropertyMapping"/>
Fixed
Dim <xsl:value-of select="@PropertyMapping"/> As <xsl:value-of select="@NetDataType"/> = SearchList.Item(CInt(RecordNumber + 1)).<xsl:value-of select="@PropertyMapping"/>

Line 358
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 390
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Line 422
Current
Dim Count As String = SearchList.Count
Fixed
Dim Count As String = SearchList.Count.ToString

Just some more wrong summary info
Line 395
Current
<![CDATA['''<summary>Moves to the first record in the search grid
Fixed
<![CDATA['''<summary>Moves to the last record in the search grid


Also in WinSearchUserControl.xsl

Lines 262 - 358

It has to do with search criteria that use a combobox.selectedvalue to search based on.
I receive the following error:
Error 135 Option Strict On disallows implicit conversions from 'Object' to 'Integer'. C:\thepath\PLWinClientSearchControl.vb 122 81
This is the code that was generated:
SearchList = BLClientInfoList.GetBLClientInfoList(SortNameTextBox.Text, AssociateIdComboBox.SelectedValue)
.SelectedValue provides an object but .GetBLClientInfoList expects an integer

I think changing lines 332 - 354 as follows should fix the problem but I'm not absolutely certain that there won't be bad side effects should a non integer value be required in this same situation.
Current
<xsl:when test="@ControlType='ComboBox'">
<xsl:choose>
<xsl:when test="position()=last()">
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue,</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@ControlType='DropDownBox'">
<xsl:choose>
<xsl:when test="position()=last()">
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue,</xsl:text>
</xsl:otherwise>
</xsl:choose>
Fixed
<xsl:when test="@ControlType='ComboBox'">
<xsl:choose>
<xsl:when test="position()=last()">
<xsl:text>CInt(</xsl:text>
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>CInt(</xsl:text>
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue),</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="@ControlType='DropDownBox'">
<xsl:choose>
<xsl:when test="position()=last()">
<xsl:text>CInt(</xsl:text>
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue)</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>CInt(</xsl:text>
<xsl:value-of select="@ControlName"/>
<xsl:text>.SelectedValue),</xsl:text>
</xsl:otherwise>
</xsl:choose>

Lines 323 and 328
Current
<xsl:text>.Value)</xsl:text>
Fixed
<xsl:text>.Value.ToString)</xsl:text>

I get the following error on this one:
Error 138 Option Strict On disallows implicit conversions from 'Date' to 'String'. C:\thepath\PLWinPaymentSearchControl.vb 116 172
Based on the following generated code:
SearchList = BLPaymentInfoList.GetBLPaymentInfoList(ClientIdComboBox.SelectedValue, Csla.SmartDate.Parse(EntryDateTimePicker.Value), Csla.SmartDate.Parse(EntryDateTimePicker1.Value), Csla.SmartDate.Parse(DueDateTimePicker.Value), Csla.SmartDate.Parse(DueDateTimePicker1.Value))


Lines 648 - 743
I'm not sure what's wrong with this one.

I get the following errors:
Error 141 'Int32' is a type in 'System' and cannot be used as an expression. C:\thepath\PLWinPaymentSearchControl.vb 300 33
Error 142 Comma, ')', or a valid expression continuation expected. C:\thepath\PLWinPaymentSearchControl.vb 300 46

Based on the following generated code:
BLPayment.ExportSearchData((System.Int32)ClientIdComboBox.SelectedValue,Csla.SmartDate.Parse(EntryDateTimePicker.Text), Csla.SmartDate.Parse(EntryDateTimePicker1.Text), Csla.SmartDate.Parse(DueDateTimePicker.Text), Csla.SmartDate.Parse(DueDateTimePicker1.Text), FileName, ExportOption, PageFields)

You are not authorized to post a reply.

Active Forums 4.0