I get :Value of type 'String' cannot be converted to '1-dimensional array
of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem
I had set up vcar above as in :
Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof
programming is seemingly worthless ....just trying to pass a variable from
one form to another and found myself with that error, which makes no sense
to me at all ...they are both strings, No ? 6 38073
When you declared vcar, you wrote it as: Friend vcar() As String when you
should have written: Friend vcar As String.
The difference is that parenthesis, which indicate that you want vcar to be
a String array (more than one value and therefore needing an index when
assigning values). So, when you wrote: vcar = curItem, you were, in
effect, saying "take this one text value from this textbox and make it be
the value of an array object".
Just take away the () on the vcar definition and you'll be all set.
"baret bonden" <ar****@network s-cc.com> wrote in message
news:2v******** *****@uni-berlin.de... I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem I had set up vcar above as in : Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof programming is seemingly worthless ....just trying to pass a variable from one form to another and found myself with that error, which makes no sense to me at all ...they are both strings, No ?
U¿ytkownik "baret bonden" <ar****@network s-cc.com> napisa³ w wiadomo¶ci
news:2v******** *****@uni-berlin.de... I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem I had set up vcar above as in : Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof programming is seemingly worthless ....just trying to pass a variable from one form to another and found myself with that error, which makes no sense to me at all ...they are both strings, No ?
vcar is an array of strings, so you have two options depending on what you
are trying to achieve:
1. Pass your string to the first element of vcar array:
Friend vcar(10) As String
vcar(0) = curItem
2. If you want an array where every element contains one char you should use
char array:
Dim vcar() As Char
vcar = curItem.ToCharA rray
Hope that helps,
Maciek
Baret,
In addition to the others.
For some (probably compatible) reasons has Microsoft standard set Option
Strict and Option explicit to Off. As far as I know have all Regulars from
this newsgroup this set to On.
Either in the options as I do or every time in top of the files.
When you set those to On you will be warned for errors at runtime.
It can be harder because with you have to set yourself more.
You can compare it like this.
Behaviour en performance of VBNet
With option Strict On = C#
With option Strict Off = VB6
I hope this helps?
Cor
"baret bonden" <ar****@network s-cc.com> I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem I had set up vcar above as in : Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof programming is seemingly worthless ....just trying to pass a variable from one form to another and found myself with that error, which makes no sense to me at all ...they are both strings, No ?
Cor,
The default setting for Option Explicit in VB.NET is ON. Option Strict is,
by default, turned OFF.
You are right though, that it is best to have them both ON.
-Scott
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:u0******** *****@TK2MSFTNG P11.phx.gbl... Baret,
In addition to the others.
For some (probably compatible) reasons has Microsoft standard set Option Strict and Option explicit to Off. As far as I know have all Regulars from this newsgroup this set to On.
Either in the options as I do or every time in top of the files.
When you set those to On you will be warned for errors at runtime.
It can be harder because with you have to set yourself more.
You can compare it like this.
Behaviour en performance of VBNet With option Strict On = C# With option Strict Off = VB6
I hope this helps?
Cor
"baret bonden" <ar****@network s-cc.com>
I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem I had set up vcar above as in : Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof programming is seemingly worthless ....just trying to pass a variable from one form to another and found myself with that error, which makes no sense to me at all ...they are both strings, No ?
Scott,
Thanks for correcting me. As I wrote I have set them on in the options so I
could not check that.
Cor
"Scott M." <s-***@nospam.nosp am> Cor,
The default setting for Option Explicit in VB.NET is ON. Option Strict is, by default, turned OFF.
You are right though, that it is best to have them both ON.
-Scott
"Cor Ligthert" <no************ @planet.nl> wrote in message news:u0******** *****@TK2MSFTNG P11.phx.gbl... Baret,
In addition to the others.
For some (probably compatible) reasons has Microsoft standard set Option Strict and Option explicit to Off. As far as I know have all Regulars from this newsgroup this set to On.
Either in the options as I do or every time in top of the files.
When you set those to On you will be warned for errors at runtime.
It can be harder because with you have to set yourself more.
You can compare it like this.
Behaviour en performance of VBNet With option Strict On = C# With option Strict Off = VB6
I hope this helps?
Cor
"baret bonden" <ar****@network s-cc.com>
I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem I had set up vcar above as in : Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof programming is seemingly worthless ....just trying to pass a variable from one form to another and found myself with that error, which makes no sense to me at all ...they are both strings, No ?
So far the only easy and pleasing thing about learning (trying to learn) VB
Net has been the kind support from this group. Many thanks.
"baret bonden" <ar****@network s-cc.com> wrote in message
news:2v******** *****@uni-berlin.de... I get :Value of type 'String' cannot be converted to '1-dimensional array of String' refering to curitem
Dim curItem As String
curItem = ListBox1.Select edItem
TextBox1.Text = curItem
vcar = curItem I had set up vcar above as in : Friend vcar() As String
I freely admit to not knowing what I'm doing here; all my 20 yearsof programming is seemingly worthless ....just trying to pass a variable from one form to another and found myself with that error, which makes no sense to me at all ...they are both strings, No ?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Francois Grieu |
last post by:
The values of ((int)0.7) and ((int)-0.7) seem to be 0
Is this independent of implementation ?
TIA,
François Grieu
|
by: TTroy |
last post by:
Hello, I'm relatively new to C and have gone through more than 4 books
on it. None mentioned anything about integral promotion, arithmetic
conversion, value preserving and unsigned preserving. And K&R2
mentions "signed extension" everywhere.
Reading some old clc posts, I've beginning to realize that these books
are over-generalizing the topic. I am just wondering what the
difference between the following pairs of terms are:
1)...
|
by: tshad |
last post by:
What is the best way to handle money in C#?
Do you use float type?
Then how do you handle rounding problems with cents as well as how best to
display it?
Thanks,
Tom
|
by: Mike Schnorr |
last post by:
I have a ASP.Net application that uses assemblies from several other
solutions. When testing the applications on my machine I build all the
referenced assemblies using nmake. The latest assemblies get placed in
a common directory that is referenced by my ASP.NET app.
Occasionally I receive the following error: value of type
"MyNamespace.MyClassName" cannot be converted to
"MyNamespace.MyClassName" (there are a lot of these for different...
|
by: David |
last post by:
I am getting the following error during run-time
compilation or a rebuild all of my application:
error BC30311: Value of type 'mynamespace.x' cannot be
converted to 'mynamespace.x'
This occurs in only one component/project that accesses
the 'x' object whereas several other components/projects
also use the 'x' object in several other locations in
exactly the same way without any problems. If I Rebuild
| |
by: Barry |
last post by:
object type cannot be converted to target type - i am getting this error message occuring numerous times in my task list, my project compiles and runs ok but it is a nuisance, I think Ihva eheard of this before but I cannot remember the solution, anybody got any help?
|
by: Jim in Arizona |
last post by:
I'm learning form an ASP.NET 1.0 book and I tried out some code that returns
this error:
Compiler Error Message: BC30311: Value of type 'Integer' cannot be converted
to 'ASP.multiclasses_aspx.VehicleKey'.
Source Error:
Line 106:
|
by: DraguVaso |
last post by:
Hi,
I'm getting in trouble with the Generic.List(Of T).
When declaring a Shadoiws of Mybase.Add, I want to do some custom actions
with the item, and cast it to another class. The problem is that I get the
whole time this error: "value of type 'T' cannot be converted to
'clsBaseClass'".
I get it with both CType and Directcast:
|
by: Mathieu Cartoixa |
last post by:
Hi,
I have been annoyed in one of my recent projects with a problem related
to the explicit implementation of an interface on a value type. I will
take an example to show the problem.
Say we have this simple interface :
interface IInitializable
{
void Init();
|
by: Horacius ReX |
last post by:
Hi,
I have the following program structure:
main
.....
int A=5;
int* ptr= A; (so at this point ptr stores address of A)
.....
.....
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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 project—planning, coding, testing, and deployment—without 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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |