|
-
Apr 27th, 2005, 05:23 PM
#1
Thread Starter
Addicted Member
Button.BackColor & Button.Image Property Issue..
HI Friends,
I am facing one more prob.
In my Windows application, I want to SET & GET BUTTON'S BACKCOLOR PROPERTY.
Ofcourse, I can GET backcolor property & save it in DATABASE,
But I CAN'T SET BACKCOLOR PROPERTY AT RUNTIME.
can you please tell me how I can SET BACKCOLOR PROPERTY AT RUNTIME [BY USING CODE]
thank you for your kind help,
-nanc
Last edited by NANC; Apr 28th, 2005 at 05:58 PM.
-
Apr 27th, 2005, 05:42 PM
#2
Re: Button.BackColor GET & SET Property Issue..
here's how I do it for all of the button controls in a group
VB Code:
For Each ctl As Control In StrategyBuildergrp.Controls
If TypeOf (ctl) Is Button Then
CType(ctl, Button).BackColor = BUTTON_COLOR
End If
Next
of course if you are changing the color of a single button, then use
VB Code:
button1.backcolor = system.drawing.color.<somecolor>
HTH
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Apr 28th, 2005, 10:58 AM
#3
Thread Starter
Addicted Member
Re: Button.BackColor GET & SET Property Issue..
Hi Friend,
Thank you for your kind help.
As you suggested for ASSIGNING backcolor to button, here is code you suggested.
---------------------VISUAL BASIC CODE-------------------
button1.backcolor = system.drawing.color.<somecolor>
-----------------------------------------------------------
my prob. is <somecolor> value will come from database which is in STRING format. And thats the only reason it dosen't work, how can I convert STRING in to COLOR ENABLED OBJECT ????
I hope, I explained well my prob.
thank you,
- nanc
-
Apr 28th, 2005, 11:19 AM
#4
Re: Button.BackColor GET & SET Property Issue..
provided the string is a valid color name you can use something like
VB Code:
Dim MyColor As String = "Gray"
Button1.BackColor = Color.FromName(MyColor)
HTH
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Apr 28th, 2005, 05:56 PM
#5
Thread Starter
Addicted Member
how to get Button.Image name
Hi Friend,
thank you for your help, it works.
but I got caught in another tiny matter,
HOW CAN I GET BUTTON.IMAGE NAME AT RUNTIME.
I am hopeful that you know the answer.
thank you,
-nanc
-
Apr 29th, 2005, 04:21 PM
#6
Thread Starter
Addicted Member
Re: Button.BackColor & Button.Image Property Issue..
Hi friends,
I think, I didn't explain my prob.
In my app., I creat COMMAND BUTTON at runtime and assign/SET property values.
I also retrive/GET property values like BUTTON.TEXT, BUTTON.BACKCOLOR, and BUTTON.IMAGE...
I can't get BUTTON.IMAGE name in text or any other form. I want to store BUTTON.IMAGE NAME IN DATABASE IN TEXT FORM.
can you pls help me out getting such matter done..
thank you,
-nanc
-
Apr 29th, 2005, 08:42 PM
#7
Re: Button.BackColor & Button.Image Property Issue..
I'm not sure you can get the image name from the button.image per se. If you set the image in your code, then maybe you can also set the button tag proerty to your image name.
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
May 4th, 2005, 05:54 PM
#8
Thread Starter
Addicted Member
Re: Button.BackColor & Button.Image Property Issue..
Its true that I can get image name from button tag property while loading button.
but, user may change image runtime, so how code can find that user has changed image & which one is the latest image.
???
little confused.
may be your little help makes a big result here.
-nanc
-
May 4th, 2005, 06:04 PM
#9
Re: Button.BackColor & Button.Image Property Issue..
Is it in your code that the user will change the image? If so, then when he/she changes the image then you can reset the tag property at the same time. It still may be possible to get the image name at run time, but I just don't know how.
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|