Home Posts Topics Members FAQ
Sam
Hi,
I can't figure out which cast I should do (using DirectCast) to solve
this one :
Dim aRow1 As Array
dtData.Rows(nRo w2).ItemArray = aRow1
Option Strict On disallows implicit conversions from 'System.Array' to
'1-dimensional array of System.Object'.
Thx
Nov 21 '05 #1
Subscribe Reply
2 1032
Nick Hall
Two choices: -
1. Use DirectCast(aRow 1, Object())
2. Declare aRow1 directly as an array of objects e.g. Dim aRow1() as Object
Usually, you use the Array class directly only if you need to call one of
the shared methods (e.g. Sort, IndexOf) or if the array type is unknown
until runtime.
Hope this helps,
Nick Hall
"Sam" <sa************ **@voila.fr> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,
I can't figure out which cast I should do (using DirectCast) to solve
this one :Dim aRow1 As Array
dtData.Rows(nRo w2).ItemArray = aRow1Option Strict On disallows implicit conversions from 'System.Array' to
'1-dimensional array of System.Object'.
Thx
Nov 21 '05 #2
Sam
thanks a lot !
Nov 21 '05 #3
This thread has been closed and replies have been disabled. Please start a new discussion.
Similar topics
1416 problem to cast object im getting from diffrent appdomain by: Daylor |last post by: first of all , PLEASE,say somthing..about my post. any reply will be nice to read. i have vb.app , with 2 appdomains. (now, in the next section , ill write "appdomain create" ,means a code in the appdomain is creating ) appdomain2 call appdomain 1 to create object of type "CCar" (the param is string ) the appdomain1 creating a object from assembly file. ( the object is of .NET Framework |
6 1825 Specified cast is not valid exception when moved from v1.0 to v1.1 by: Raj |last post by: I have a c# program in which I used cast. That worked perfectly on .Net platform 1.0. When I moved to .Net 2003, I am getting the execption "Specified cast is not valid". I have not made any changes to the code. Is there any difference in project settings or something else between v1.0 and v1.1? Thanks in advance. -- Raj .NET Framework |
1679 VC++: Cast operator not used? by: A. W. Dunstan |last post by: I'm porting some code to Visual C++ and have run into a problem - the compiler won't use a user-written cast operator. The code uses an envelope-letter approach to passing (potentially) large pieces of data around, and requires that certain methods return an Envelope with a specific kind of Letter as it's content. I have a cast operator that converts from what I've got to what should be returned, but it seems that the compiler only... C / C++ |
3 16586 CAST Command by: Mike |last post by: I am using MS-Access as a front end for my MS-SQL DB. I have a sql view that uses the following: SELECT TOP 100 PERCENT RECID, PATNUMBER AS , SVCCODE AS , QTY, PROF_CHRGS AS , AMOUNT, BILLDATE AS , CHKAMT AS , PSDATE AS , POSTDATE AS , TRNSCODE AS , TRLR AS , SUBSTRING(CAST(SVCCODE AS varchar), 1, 4) AS FROM dbo.PAT_Transactions ORDER BY PATNUMBER, SVCCODE Microsoft SQL Server |
36 6698 to cast or not to cast malloc ? by: MSG |last post by: The answer is neither. Use macros. #define ALLOC(size, type) ((type) *) malloc((size) * sizeof(type)) #define NEW(type, name, size) (type) * (name) = ALLOC((size), (type)) They are both type-safe and concise. Compare: NEW(int, x, 1000); C / C++ |
17 2681 Why does this object need to be cast? by: Hazz |last post by: In this sample code of ownerdraw drawmode, why does the '(ComboBox) sender' line of code need to be there in this event handler? Isn't cboFont passed via the managed heap, not the stack, into this cboFont_DrawItem event handler? Why does it need to be cast? -hazz ,................. cboFont.Items.AddRange(FontFamily.Families); } private void cboFont_DrawItem(object sender, C# / C Sharp |
1687 Datagrid Item - Invalid Cast by: Alan Z. Scharf |last post by: Win Server 2003 VS.Net 2003 --------------- 1. I'm having the same problem below on all six of my pages with a datagrid item. 2. These pages all worked fine for months until problem started. 3. Same problem on two different computers running Win 2003. C# / C Sharp |
5 3447 Invalid Cast Exception Calling Bsse Class Method by: Nick Flandry |last post by: I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS 5), but fails on IIS 6 running on a Win2003 server. The web uses Pages derived from a custom class I wrote (which itself derives from Page) to provide some common functionality. The Page_Load handler the failing webpage starts out like this: ... ASP.NET |
3 1700 Specified cast not valid by: Mike Cooper |last post by: Hello All! I am getting teh above error message on the following code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim dgt As DataGridTableStyle = Main_DataGrid.TableStyles(0) Dim cm As CurrencyManager = CType(Me.BindingContext _ Visual Basic .NET |
2 4302 cast List<SubClass> to ICollection<Class> by: =?Utf-8?B?Unlhbg==?= |last post by: Hi, How can I get around runtime error that says I can not explicit cast List<SubClassto ICollection<Class>? Generic List inhertis generic ICollection and Subclass inherits Class, then should not a problem to cast it explicitly, right? C# / C Sharp |
9721
What is ONU? by: marktang |last post by: ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of... General |
1 10374 The easy way to turn off automatic updates for Windows 10/11 by: Hystou |last post by: Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,... Windows Server |
10114
Discussion: How does Zigbee compare with other wireless protocols in smart home applications? by: tracyyun |last post by: Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some... General |
9196
AI Job Threat for Devs by: agi2029 |last post by: Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea... Career Advice |
1 7651
Access Europe - Using VBA to create a class based on a table - Wed 1 May by: isladogs |last post by: The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will... Microsoft Access / VBA |
5548 Trying to create a lan-to-lan vpn between two differents networks by: TSSRALBI |last post by: Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls... Networking - Hardware / Configuration |
5686 Windows Forms - .Net 8.0 by: adsilva |last post by: A Windows Forms form does not have the event Unload, like VB6. What one acts like? Visual Basic .NET |
1 4331 transfer the data from one system to another through ip address by: 6302768590 |last post by: Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system C# / C Sharp |
3 3011
Comprehensive Guide to Website Development in Toronto: Expert Insights from BSMN Consultancy by: bsmnconsultancy |last post by: In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive... General |
By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.
To disable or enable advertisem*nts and analytics tracking please visit the page.