How to change the color of textbox at runtime in VB?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shailja
    New Member
    • Feb 2007
    • 123

    How to change the color of textbox at runtime in VB?

    Hello,

    Please can anyone suggest me code to change the color of textbox at runtime in VB?
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by Shailja
    Hello,

    Please can anyone suggest me code to change the color of textbox at runtime in VB?
    txt.backcolor=r gb(255,0,0)
    txt.forecolor=v bblack

    Comment

    • vijaydiwakar
      Contributor
      • Feb 2007
      • 579

      #3
      Originally posted by Shailja
      Hello,

      Please can anyone suggest me code to change the color of textbox at runtime in VB?
      Shailja
      yesterday i suggest u to use itemdata of combo box
      due to lack of time i'm unable to give u code
      now try this
      this code is bug free and have lavel of erp standards
      Code:
      Private Sub cboMode_DropDown()
      
          Dim sSql        As String
          Dim Rsdata      As New ADODB.Recordset
          sSql = ""
          sSql = "Select CompID , CompName From Company"
          Rsdata.Open sSql, c_Cnn, adOpenForwardOnly, adLockReadOnly
          cboMode.Clear
          While Not (Rsdata.EOF Or Rsdata.BOF)
              cboMode.AddItem Rsdata!CompName & ""
              cboMode.ItemData(cboMode.NewIndex) = Rsdata!CompID & ""
              Rsdata.MoveNext
          Wend
          Set Rsdata = Nothing
      End Sub
      
      on change event of combo write
       Dim sSql        As String
          Dim Rsdata      As New ADODB.Recordset
      ssql=select * from table where compid=" &  Val(cbomode.ItemData(cbomode.ListIndex))
      ' write the code here

      Comment

      Working...