473,324 Members | 2,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

cant assign variable values to property in Class file

Avi
Hi

I am creating web application in which i want to assign by
default values to the property which i had created my own. In that one
of the property is of type color and i am unable to assign any value to
that color type property..

my code is

Dim Col1Color as String

vartable="------"
vartable&= TDCOLOR1

i got error:- & operator not defined for System.Object and
syste.Drawing.Color

plz help me out

Thanks in advance

Dec 11 '06 #1
4 2481
Basically vartable looks like an object while TDCOLOR1 is a
System.Drawing.Color object and &= is the string concatenation operator. You
can't string concatenate an object and a Color object.

I would declare vartable as a color and would use Vartable=TDCOLOR1 but I'm
not sure this is what you are trying to do (vartable="-----" wouldn't work
any more but why are you doing this if vartable ios really supposed ton be a
color object ?)

--
Patrice

"Avi" <st******************@gmail.coma écrit dans le message de news:
11*********************@j44g2000cwa.googlegroups.c om...
Hi

I am creating web application in which i want to assign by
default values to the property which i had created my own. In that one
of the property is of type color and i am unable to assign any value to
that color type property..

my code is

Dim Col1Color as String

vartable="------"
vartable&= TDCOLOR1

i got error:- & operator not defined for System.Object and
syste.Drawing.Color

plz help me out

Thanks in advance

Dec 11 '06 #2
Avi
Hi Patrice,

what i m doing is.

I hav a one class file in which i had created some property and
assigning some default values to those property. in the NEW() function
OK. Again in this NEW() function i had created one dynamic table and
those property are related to that table.
in the Page Load() funtion of .aspx file i want to give some new
values to those property

now problem is that

When application starts it call first NEW( ) function in which table
with default values get generated and now in Page Laod( ) function i
want to assign new values in place of those default values. which i
cant. so is there any way to call the NEW( ) from Page_Load( )
.......

Dec 12 '06 #3
I meant rather what is the final non technical goal. For example is vartable
supposed to store a color object ? Is this a list of colors as the
concatenation seems to imply ? etc...

For now :
- vartable is an object (but you assign first a string to it ?)
- TDCOLOR1 is a color object
- you try to string concatenate these two objects ?

So you can't string concatenate those two objects, hthis is as if you would
try to add a string and a date. It doesn't make sense.

So you have multiple solutions such as :
vartable=TDCOLOR1 (both being Color object)
vartable &= TDCOLOR1.ToString vartable being a string and converting
TDCOLOR1 to a string (but you would store multiple colors without any
separator ?)
vartable(i)=TDCOLOR vartable being an array of colors

For now the code exceprt doesn't make clear what your intent is :
- you provide the declaration for Col1Color but it is not used in your code
- we don"t know how vartbale TDCOLOR1 are declared though it is used in your
code
- from the message you try to string concatenate a color and an object (but
it looks weird you first put ----- in vartbale etc...)
etc...

--
Patrice

"Avi" <st******************@gmail.coma écrit dans le message de news:
11*********************@79g2000cws.googlegroups.co m...
Hi Patrice,

what i m doing is.

I hav a one class file in which i had created some property and
assigning some default values to those property. in the NEW() function
OK. Again in this NEW() function i had created one dynamic table and
those property are related to that table.
in the Page Load() funtion of .aspx file i want to give some new
values to those property

now problem is that

When application starts it call first NEW( ) function in which table
with default values get generated and now in Page Laod( ) function i
want to assign new values in place of those default values. which i
cant. so is there any way to call the NEW( ) from Page_Load( )
......

Dec 12 '06 #4
Avi wrote:
I hav a one class file in which i had created some property and
assigning some default values to those property. in the NEW() function
OK. Again in this NEW() function i had created one dynamic table and
those property are related to that table.
in the Page Load() funtion of .aspx file i want to give some new
values to those property
Class X
' ?Inherits Y

Public Sub New()
End Sub

Public Property TDBackground() as Color
Get
Return colorTD
End Get
Set( Value as Color )
colorTD = Value
End Set
End Property

Private colorTD as Color = Color.Black

End Class

Private oX As New X()

Sub Page_Load( ...
oX.TDBackground = Color.Green
End Sub
When application starts it call first NEW( ) function in which table
with default values get generated and now in Page Laod( ) function i
want to assign new values in place of those default values. which i
cant. so is there any way to call the NEW( ) from Page_Load( )
No, but you could either create a "reload" method can you call from
New() and elsewhere or, perhaps better, add a "Render" method that
generates the HTML based on the properties you've set.

Public Function Render() As String
' I'm guessing at what this needs to do ...
' I think the "x2" will work - haven't tried it
Dim sColor as String _
= colorTD.Red.ToString("x2") _
& colorTD.Green.ToString("x2") _
& colorTD.Blue.ToString("x2")
Return "<td bgcolor='#" & sColor & "'>"
End Function

HTH,
Phill W.
Dec 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Rim | last post by:
Hi, I have been thinking about how to overload the assign operation '='. In many cases, I wanted to provide users of my packages a natural interface to the extended built-in types I created for...
16
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...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
4
by: darrel | last post by:
Karl has helped me in the past in regards to communicating between controls and pages: http://www.openmymind.net/communication/index.html#3.1 I ended up going down the interfaces path and...
2
by: Microsoft | last post by:
I have a variable that will equal something like this.. result= joe,200,male,sales I know if I save the values to a text file and open it in EXCEL it shows up in a nice colum format (csv) ...
1
by: Joe Cool | last post by:
Using VB.NET 2005. I will not go into detail on a problem I can't figure out, but I will describe it simple terms that should convey the underlying issue. I have a class called ClassA. It has...
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
8
by: Jeff | last post by:
Still new to vb.net in VS2005 web developer... What is the proper/standard way of doing the following - setting the value of a variable in one sub and calling it from another? E.g., as below....
6
by: Don Lancaster | last post by:
I need to progrmatically do this inside a loop this.fh03.value = fixFloat (Harms, numPoints) ; with the numbers changing per an index. If I try curHvals = "03" ; // (derived from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.