Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Go Back  Xtreme Visual Basic Talk > > > Option Strict On Bisallows Late Binding


Reply
 
Thread Tools Display Modes
  #1  
Old 10-20-2005, 10:22 AM
blueydbabiboy blueydbabiboy is offline
Newcomer
 
Join Date: Sep 2005
Posts: 16
Default Option Strict On Disallows Late Binding


Ok guys, I have tried everything that I know, and I can not get this to work. The program works perfect when Option Strict is Turned Off, but when On I get the Error: Option Strict On Bisallows Late Binding. Here is the code that I am getting the error in....

Code:
Dim oRng1, oRng2 As Object
oRng1 = mWS.Cells(i, 1)
oRng1.Value = "Date & Time:"
I am getting the error on the last line. Now I know why I am getting this error, I just don't know how to fix it. I had the oRng1 and oRng2 set as Excel.Range, but then I got another error about implicit conversions from System.Object to Excel.Range.

I am waiting on a reply Mike R.... ....Since you have been so helpful so far....

Blu

Last edited by blueydbabiboy; 10-20-2005 at 10:30 AM.
Reply With Quote
  #2  
Old 10-20-2005, 10:30 AM
Volte's Avatar
VolteOption Strict On Bisallows Late Binding Volte is offline
Ultimate Contributor

Retired Leader
* Guru *
 
Join Date: Aug 2001
Posts: 5,344
Default

Keep the two objects as Excel.Range, and use DirectCast to avoid the implicit conversion error:
Code:
oRng1 = DirectCast(mWS.Cells(i, 1), Excel.Range)
Reply With Quote
  #3  
Old 10-20-2005, 10:36 AM
blueydbabiboy blueydbabiboy is offline
Newcomer
 
Join Date: Sep 2005
Posts: 16
Default

Life saver, I tried CType() at one point. But now i Know...
Reply With Quote
  #4  
Old 10-22-2005, 05:22 AM
Mike Rosenblum's Avatar
Mike Rosenblum Mike Rosenblum is offline
Microsoft Excel MVP

Forum Leader
* Guru *
 
Join Date: Jul 2003
Location: New York, NY, USA
Posts: 7,848
Default

CType() should have worked too, you must have done something wrong? Try it now to prove it to yourself.

'Option Strict' is god's gift to modern programming. I am still using VB6/VBA currently and get hit with problems like this:
Code:
Dim xlRng As Excel.Range Set xlRng = xlApp.Range("A1") xlRng.Bold = True ' <-- Oops, this line is no good!
Now what I obviously meant to write was 'xlRng.Font.Bold = True', but I goofeed... But that was just one small line among many I had recently added and the code compiled 100% fine. That's right, in VB6 the compiler does not tell me that 'xlRng.Bold' does not exist. The compiler must be considering late-binding or maybe inheritance possibilities? Tracking down this error can be a massive loss of time depending on what other code is around it.

But in .Net, with 'Option Strict' turned on, well, this mistake is picked up at compile-time. It's a beautiful thing.
__________________
My Articles:
| Excel from .NET | Excel RibbonX using VBA | Excel from VB6 | CVErr in .NET | MVP |
Avatar by Lebb
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
 
Option Strict On Bisallows Late Binding
Option Strict On Bisallows Late Binding
 
-->