|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Option Strict disallows late binding, need to update codethe following code generates an error with option strict on - Option strict disallows late binding. Can someone please help with what needs to be changed: Dim sweep, totalsweep As Integer Dim slices As Array = Split("26, 40, 34",",") Dim colors() As Color = { _ Color.Blue, Color.LimeGreen, _ Color.Purple} Dim brush As System.Drawing.SolidBrush Dim g As System.Drawing.Graphics g = Me.CreateGraphics For i As Integer = 0 To UBound(slices) brush = New System.Drawing.SolidBrush(colors(i)) sweep = 360 * (CLng(slices(i)) / 100) '<----PROBLEM HERE If totalsweep + sweep > 360 Then _ sweep = 360 - totalsweep g.FillPie(brush, New Rectangle(0, 0, 80, 80), _ totalsweep, sweep) totalsweep += sweep Next Thanks CodeMonkey.
Show quote
Hide quote
"CodeMonkey" <agaskel***@yahoo.com> schrieb: Replace the line above with this:> the following code generates an error with option strict on - Option > strict disallows late binding. Can someone please help with what needs > to be changed: > > Dim sweep, totalsweep As Integer > Dim slices As Array = Split("26, 40, 34",",") > Dim colors() As Color = { _ > Color.Blue, Color.LimeGreen, _ > Color.Purple} > Dim brush As System.Drawing.SolidBrush > Dim g As System.Drawing.Graphics > g = Me.CreateGraphics > > For i As Integer = 0 To UBound(slices) > > brush = New System.Drawing.SolidBrush(colors(i)) > sweep = 360 * (CLng(slices(i)) / 100) '<----PROBLEM HERE \\\ sweep = CInt(360 * (CLng(slices.GetValue(i)) / 100)) /// -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> You may also want to change
Dim slices As Array = Split("26, 40, 34",",") to Dim slices() As String = Split("26, 40, 34", ",") because it appears that your intention is that slices is an array of strings. "AMercer" <AMer***@discussions.microsoft.com> schrieb: Full ACK. Thanks for adding that... :-).> You may also want to change > Dim slices As Array = Split("26, 40, 34",",") > to > Dim slices() As String = Split("26, 40, 34", ",") > because it appears that your intention is that slices is an array of > strings. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Change this line:
Dim slices As Array = Split("26, 40, 34", ",") To Dim slices As String() = Split("26, 40, 34", ",") HTH, Sam Show quoteHide quote On 6 Apr 2005 10:31:07 -0700, "CodeMonkey" <agaskel***@yahoo.com> B-Line is now hiring one Washington D.C. area VB.NET wrote: >Hi All >the following code generates an error with option strict on - Option >strict disallows late binding. Can someone please help with what needs >to be changed: > >Dim sweep, totalsweep As Integer >Dim slices As Array = Split("26, 40, 34",",") >Dim colors() As Color = { _ >Color.Blue, Color.LimeGreen, _ >Color.Purple} >Dim brush As System.Drawing.SolidBrush >Dim g As System.Drawing.Graphics >g = Me.CreateGraphics > >For i As Integer = 0 To UBound(slices) > >brush = New System.Drawing.SolidBrush(colors(i)) >sweep = 360 * (CLng(slices(i)) / 100) '<----PROBLEM HERE >If totalsweep + sweep > 360 Then _ >sweep = 360 - totalsweep >g.FillPie(brush, New Rectangle(0, 0, 80, 80), _ >totalsweep, sweep) >totalsweep += sweep >Next > >Thanks >CodeMonkey. developer for WinForms + WebServices position. Seaking mid to senior level developer. For information or to apply e-mail resume to sam_blinex_com. Or even:
>Dim slices As Array = Split("26, 40, 34", ",") to >Dim slices As String() = Split("26, 40, 34", ",") Dim slices As String() = {"26", "40", "34"} Marcie On Wed, 06 Apr 2005 14:17:11 -0400, Samuel R. Neff <blinex@newsgroup.nospam> wrote: Show quoteHide quote > >Change this line: > >Dim slices As Array = Split("26, 40, 34", ",") > >To > >Dim slices As String() = Split("26, 40, 34", ",") > >HTH, > >Sam > > >On 6 Apr 2005 10:31:07 -0700, "CodeMonkey" <agaskel***@yahoo.com> >wrote: > >>Hi All >>the following code generates an error with option strict on - Option >>strict disallows late binding. Can someone please help with what needs >>to be changed: >> >>Dim sweep, totalsweep As Integer >>Dim slices As Array = Split("26, 40, 34",",") >>Dim colors() As Color = { _ >>Color.Blue, Color.LimeGreen, _ >>Color.Purple} >>Dim brush As System.Drawing.SolidBrush >>Dim g As System.Drawing.Graphics >>g = Me.CreateGraphics >> >>For i As Integer = 0 To UBound(slices) >> >>brush = New System.Drawing.SolidBrush(colors(i)) >>sweep = 360 * (CLng(slices(i)) / 100) '<----PROBLEM HERE >>If totalsweep + sweep > 360 Then _ >>sweep = 360 - totalsweep >>g.FillPie(brush, New Rectangle(0, 0, 80, 80), _ >>totalsweep, sweep) >>totalsweep += sweep >>Next >> >>Thanks >>CodeMonkey. > >B-Line is now hiring one Washington D.C. area VB.NET >developer for WinForms + WebServices position. >Seaking mid to senior level developer. For >information or to apply e-mail resume to >sam_blinex_com. Or
Dim slices As Integer() = {26, 40, 34} Then no need for conversion later. Sam On Wed, 06 Apr 2005 14:31:28 -0400, Marcie Jones <marciejo***@yahoo.com> wrote: Show quoteHide quote >Or even: B-Line is now hiring one Washington D.C. area VB.NET > >>Dim slices As Array = Split("26, 40, 34", ",") >>Dim slices As String() = Split("26, 40, 34", ",") > >to >Dim slices As String() = {"26", "40", "34"} > >Marcie > >On Wed, 06 Apr 2005 14:17:11 -0400, Samuel R. Neff ><blinex@newsgroup.nospam> wrote: > >> >>Change this line: >> >>Dim slices As Array = Split("26, 40, 34", ",") >> >>To >> >>Dim slices As String() = Split("26, 40, 34", ",") >> >>HTH, >> >>Sam >> developer for WinForms + WebServices position. Seaking mid to senior level developer. For information or to apply e-mail resume to sam_blinex_com. All,
thanks for your extremely prompt and accurate help. Regards CodeMonkey. Samuel R. Neff wrote: Show quoteHide quote > Or > > Dim slices As Integer() = {26, 40, 34} > > Then no need for conversion later. > > Sam > > > On Wed, 06 Apr 2005 14:31:28 -0400, Marcie Jones > <marciejo***@yahoo.com> wrote: > > >Or even: > > > >>Dim slices As Array = Split("26, 40, 34", ",") > >>Dim slices As String() = Split("26, 40, 34", ",") > > > >to > >Dim slices As String() = {"26", "40", "34"} > > > >Marcie > > > >On Wed, 06 Apr 2005 14:17:11 -0400, Samuel R. Neff > ><blinex@newsgroup.nospam> wrote: > > > >> > >>Change this line: > >> > >>Dim slices As Array = Split("26, 40, 34", ",") > >> > >>To > >> > >>Dim slices As String() = Split("26, 40, 34", ",") > >> > >>HTH, > >> > >>Sam > >> > B-Line is now hiring one Washington D.C. area VB.NET > developer for WinForms + WebServices position. > Seaking mid to senior level developer. For > information or to apply e-mail resume to > sam_blinex_com.
What am I doing wrong - Trying to update
Microsoft not content with "dissing" just the Classic VB Developer Army.... Setup project registery values with app install folder in them Set textbox1.enabled = false inside a module? Event for PgUp and PgDn on Form How to get current free physical memory ? How to create a zoom feature in Vb.Net '' Could not be set on property 'Items' - Error Icons in a class library Help converting Buffer of Bytes to string |
|||||||||||||||||||||||