it shows the timer_tick coding? [Resolved]

Posted by Sudheep.grandhe under C# on 11/4/2011 | Points: 10 | Views : 1179 | Status : [Member] | Replies : 8
Hi,

it shows the timer_tick coding?.I am underlying the error part.please find it.please do the needful.

Error 1:-Operator '&' cannot be applied to operands of type 'string' and 'string'
Error 2:- ; expected
private void timer1_Tick(object sender, EventArgs e)
{
L1.Text = L1.Text.Substring(1) & L1.Text.Substring(0, 1);
L2.Visible =not L2 .Visible ();
L2.ForeColor =Color.FromArgb (rnd() * 255,rnd() * 255,rnd() * 255);
}

Best,
Sudheep.



Responses

Posted by: Blessyjees on: 11/4/2011 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Hi,

Are you tried to combone two string in the sentence L1.Text = L1.Text.Substring(1) & L1.Text.Substring(0, 1);
If so use + in the place of &.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 11/4/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
I want to display the label in blinking format for that i wrote the code it shows this error.
Error 2:- ; expected
L2.Visible =not L2 .Visible ();
L2.ForeColor =Color.FromArgb (rnd() * 255,rnd() * 255,rnd() * 255);

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 11/4/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi Sudheep,

L2.Visible =not L2 .Visible ();
This line means id l2 is visible, then hide other wise visible, corerct? You are using VB syntax for "Not" . in C# this is "!". Chane this and try again.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 11/4/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
it shows the error.followed one
Error 1 The name 'rnd' does not exist in the current context.where i have to declare this rnd()

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 11/4/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,
What is rnd. are you mean random number, if so see the link
http://www.c-sharpcorner.com/UploadFile/mahesh/RandomNumber11232005010428AM/RandomNumber.aspx
for generating random nmbers in c#

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 11/4/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

rnd() means it shows random colors.i want to show random colors for the specified label3.

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 11/4/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Update this code with c# random code( refer the above link) and try.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 11/4/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
If i wrote this code the following error shows.please do the needful.
L2.ForeColor =Color.FromArgb (rnd() * 255,rnd() * 255,rnd() * 255);
Error 1 The name 'rnd' does not exist in the current context.where i have to declare this rnd()

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response