home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,624 of 10,840   
   Rick Rothstein to All   
   Re: VB.NET backcolor syntax   
   21 Jul 05 14:46:54   
   
   From: rickNOSPAMnews@NOSPAMcomcast.net   
      
   > Can anyone tell me the correct syntax when using a variable to control   
   > the color property?   
   >   
   > This works ok:   
   > If ABC2flash Then Label61.BackColor = Color.Yellow   
   >   
   > This doesn't, showing syntax error in source code:   
   > Dim ABC1col As String = "Color.Yellow"   
   > If ABC2flash Then Label61.BackColor = ABC1col   
      
   I don't use VB.NET myself (see the note at the end of this posting), but   
   I think I can guess at your problem. The BackColor property is a number   
   (in VB6 it would be a Long, but I'm not sure of the data type in VB.NET,   
   you'll have to look that up in your help files). You have defined   
   ABC1col as a String variable and are trying to assign a String variable   
   to a property requiring a numerical data type... hence, your error. Try   
   this (substituting the correct data type where I used    
   as a place holder):   
      
   Dim ABC1col As  = Color.Yellow   
   If ABC2flash Then Label61.BackColor = ABC1col   
      
   Now, for the note I told you about...   
      
   Almost everybody in this newsgroup is using VB6 or lower. While you may   
   get a stray answer to VB.NET (including VB2003 and VB2005 which has   
   dropped .NET from its name) questions here, you should ask them in   
   newsgroups devoted exclusively to .NET programming. Look for newsgroups   
   with either the word "dotnet" or "vsnet" in their name.   
      
   For the microsoft news server, try these newsgroups for Visual Basic   
   .NET related questions...   
      
      microsoft.public.dotnet.languages.vb   
      microsoft.public.dotnet.languages.vb.upgrade   
      microsoft.public.dotnet.languages.vb.controls   
      microsoft.public.dotnet.languages.vb.data   
      
   And these for more general .NET questions   
      
      microsoft.public.dotnet.general   
      microsoft.public.vsnet.general   
      
   Note: There are many other .NET newgroups (use the first three "fields"   
   from the last two as templates when searching for them), but the above   
   ones should get you started.   
      
   Rick   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca