Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mobile text box background color

Status
Not open for further replies.

leearach2004

Technical User
Dec 8, 2005
86
GB
Hi there I am new to creating mobile web applications using vs 2005.

I wish to change the background colour of a mobile text box at runtime, displaying green background if the value is 1 and red if it is 0.

I can change the background of the whole form by using
Code:
if(textbox.text = 1)
me.fomr1.BackColor = Drawing.Color.LightGreen
else
me.fomr1.BackColor = Drawing.Color.Red
end if
this changes the forms background fine but i want to change the text box background
I have tried using
Code:
me.textBox1.BackColor = Drawing.Color.Red
this does not show any errors and the option ios their to use the property but it does not change the textbox colour

My code is as follows
Code:
 Protected Sub oblstRec_ItemSelect(ByVal sender As Object, ByVal e As System.Web.UI.MobileControls.ObjectListSelectEventArgs) Handles oblstRec.ItemSelect
        Me.ActiveForm = frmRes
        lblpartn.Text = e.ListItem.Item("PartNumber")
        txtpartn.Text = e.ListItem.Item("PartName")
        txtcon.Text = e.ListItem.Item("Condition")
        txtloc.Text = e.ListItem.Item("Location")
        txtquan.Text = e.ListItem.Item("Quantity")
        txtval.Text = e.ListItem.Item("Valid")
        If (txtval.Text = 0) Then
            txtval.BackColor = Drawing.Color.Red
        Else
            txtval.BackColor = Drawing.Color.LightGreen
        End If
       
    End Sub

hope somone can help cant seem to find anything on the net about it
lee
 
is it always lightgreen?

-The answer to your problem may not be the answer to your question.
 
This works:
Code:
TextBox1.BackColor = Color.Chocolate

-The answer to your problem may not be the answer to your question.
 
No cannot change the colour of any controls background for some reason, i am using mboile forms
 
You just contradicted yourself. You said that you can change the color of the form background, but cannot change the color of any of the controls. The form a type of control.

Are there special textbox controls that you have to use with the mobile form?

-The answer to your problem may not be the answer to your question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top