I'm a newbie with Vb.NET so please excuse me if this is a stupid quetion.
I have declared a structure:
Structure ClientRecord
Public Client_ID As Integer
Public Client_Initials As String
Public Client_Surname As String
End Structure 'ClientRecord
I also have declared a property which is of this type of the structure:
Public Property Client() As ClientRecord
Get
Return FClient
End Get
Set(ByVal Value As ClientRecord)
FClient = Value
End Set
End Property
Now, in another form,i wish to set the values contained in the property
Client:
frmPolicy.Clien t.Client_ID = CInt(lblClientI D.Text)
HOWEVER - I GET THE ERROR:
'Expression is a value and therefore cannot be the target of an assignment".
HOW SHOULD I DO THE ASSIGNMENT?
Any help would be most welcome!
Thanks
Suzie 2 8250
Dont worry guys - I found a better solution by declaring the ClientRecord
datatype as a class instead of a structure. Now i dont have that probelm
anymore.
While i've found a solution i still dont understand what was wrong before
with the code i had, so any comments will still be welcome ...
thanks
Suzie
"Suzie" wrote: I'm a newbie with Vb.NET so please excuse me if this is a stupid quetion.
I have declared a structure:
Structure ClientRecord Public Client_ID As Integer Public Client_Initials As String Public Client_Surname As String End Structure 'ClientRecord
I also have declared a property which is of this type of the structure:
Public Property Client() As ClientRecord Get Return FClient End Get Set(ByVal Value As ClientRecord) FClient = Value End Set End Property
Now, in another form,i wish to set the values contained in the property Client:
frmPolicy.Clien t.Client_ID = CInt(lblClientI D.Text)
HOWEVER - I GET THE ERROR: 'Expression is a value and therefore cannot be the target of an assignment".
HOW SHOULD I DO THE ASSIGNMENT?
Any help would be most welcome!
Thanks Suzie
>While i've found a solution i still dont understand what was wrong before with the code i had, so any comments will still be welcome ...
When it's a structore the property will return a copy of the FClient
value, and when you assign the Client_ID you would just end up
modifying that temporary copy.
When it's a class you get back a reference to the same object and any
changes you ake affects FClient as well.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Golf Nut |
last post by:
I am finding that altering and affecting values in elements in
multidimensional arrays is a huge pain in the ass. I cannot seem to find a
consistent way to assign values to arrays. Foreach would clearly be the most
efficient way to do it, but it only works on a copy of the original array
and not the original (which is counter intuitive in my estimation). Using
each doesn't work consistently either. Not only that, it's unduly complex
for...
|
by: steflhermitte |
last post by:
Dear cpp-ians,
I am working with a structure
struct segment
{
....
vector <meta_segment>::iterator it_Z;
....
};
|
by: sneill |
last post by:
How is it possible to take the value of a variable (in this case,
MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name?
In the following example I want 'oIcon' object to have the properties:
mode1, mode2, and mode3.
This seems simple but I can't quite figure it out...
Any ideas anyone?
|
by: Brett |
last post by:
I have created a structure with five fields. I then create an array of this
type of structure and place the structure into an array element. Say index
one. I want to assign a value to field3 of the structure inside the array.
When I try this, an error about late assignment appears. Is it possible to
assign a value to a structure field that is in an array?
I'm currently getting around the problem by creating a new structure, assign...
|
by: Chris Wertman |
last post by:
I am so lost on this one.
Dim Ary as Integer = New Integer(4) {0,1,2,3}
FAILS with the error:
Array initializer has 1 too few elements.
So I try
Dim Ary as Integer = New Integer(3) {0,1,2,3}
Since arrays start at 0 (I am thinking)
| |
by: dBNovice |
last post by:
Hi all! I have 3 separate forms: Tasks, Subtasks, and Elements. All 3
is related by TaskId and Subtasks and Elements are related by
SubtaskID. In the DB after I add a task, I want to be able to add one
or more subtasks and then one or more elements. I need the subtasks
and elements to be have the same taskid as the task; also I want the
element to have the same subtaskId as the subtask. I have been able to
design the system to include...
|
by: skumar434 |
last post by:
Hi everybody,
I am faceing problem while assigning the memory dynamically to a array
of structures .
Suppose I have a structure
typedef struct hom_id{
int32_t nod_de;
int32_t hom_id;
|
by: Chuck Anderson |
last post by:
My knowledge of JavaScript is limited. I learn from example and then
adapt those examples to suit my needs.
I have stumped myself on this one.
I have a form with checkboxes that I want to group by using a two
dimensional array.
<form name=msgs>
|
by: joaotsetsemoita |
last post by:
Hello everyone,
I'm having troubles assigning an onclick event to a cell. Im trying
something like
cursorPoint.cells.style.cursor = "hand";
cursorPoint.cells.width = "20";
cursorPoint.cells.onclick = "alert('this is a test');"
cursorPoint.cells.alt = "Select the columns";
cursorPoint.cells.innerHTML = " "
|
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, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
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: 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...
| |