473,411 Members | 2,285 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

How to use left function in VB2005

Hi

I want to change ForeColor but only for control names starting with letters lbl


I've got something like this

Dim x as control

For each x in controls

' how can I use function left in here to check only the first three letters?see below

If left(x.name,3) = "lbl" then 'this of course doesn't work
x.forecolor = color.orange
End if
Next

Many thanks in advance
Jan 16 '08 #1
7 1833
kadghar
1,295 Expert 1GB
Hi
' how can I use function left in here to check only the first three letters?see below

If left(x.name,3) = "lbl" then 'this of course doesn't work
x.forecolor = color.orange
End if
Next

Many thanks in advance
yeah, some sintax changes =( so sad
use mid(x.name,1,3)
HTH
Jan 16 '08 #2
Killer42
8,435 Expert 8TB
What, they've removed the Left() function in VB2005? That's a little disappointing.
Jan 17 '08 #3
mafaisal
142 100+
hello

I think
this is working by importing microsoft.visualbasic

Microsoft.VisualBasic.Strings.left(x.name,3)



Hi

I want to change ForeColor but only for control names starting with letters lbl


I've got something like this

Dim x as control

For each x in controls

' how can I use function left in here to check only the first three letters?see below

If left(x.name,3) = "lbl" then 'this of course doesn't work
x.forecolor = color.orange
End if
Next

Many thanks in advance
Jan 17 '08 #4
Thanks for that, I think I will just use mid instead :)

Just wondering does VB8 have right function?
Jan 17 '08 #5
Now I have also a different problem,

For some reason when I use For each x in controls (on everything) it is omitting some controls.

The only thing I found is that I have change the forecolor in them but there are still the same (controltext) only there are in bold in the properties pane for some reason.

So if I change a forecolor property (originally controltext (not in bold)) to different one and back to original it is bold and it stops working with the for each x in controls??????????????????
Jan 17 '08 #6
Killer42
8,435 Expert 8TB
I'm afraid I didn't follow you very well, there. But are you sure they're not just being processed in a different sequence to what you expect?
Jan 17 '08 #7
QVeen72
1,445 Expert 1GB
For some reason when I use For each x in controls (on everything) it is omitting some controls.
Controls that are placed on the Containers like (Frame, GroupBox or Picture Box) are Omitted, they are not Part of the Form's Controls Group.
In such cases, you have to first loop thru all the Frames, Change the properties of these child controls .. some thing like this :

Expand|Select|Wrap|Line Numbers
  1. Dim ctl As System.Windows.Forms.Control
  2. Dim ctl1 As System.Windows.Forms.Control
  3. '
  4. For Each ctl In Me.Controls
  5.     If VB.Left(ctl.Name, 5) = "Label" Then
  6.         ctl.ForeColor = Me.ForeColor
  7.     ElseIf VB.Left(ctl.Name, 5) = "Frame" Then
  8.         For Each ctl1 In ctl.Controls
  9.             ctl1.ForeColor = Me.ForeColor
  10.         Next
  11.     End If
  12. Next ctl
  13.  
Note I have Imported Visual Basic:

Imports VB = Microsoft.VisualBasic

Regards
Veena
Jan 18 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Chris Devol | last post by:
My dial-up connection sometimes hangs up and has to re-connect. The VB2005 installer/downloader apparently doesn't know how to resume when the connection is re-established. It just aborts! I've...
3
by: Diarmuid | last post by:
I have the MS book, introducing Microsoft Visual Basic 2005 for Developers. No sample code comes with it.The location according to the book is http://msdn.microsoft.com/vbasic/VB6Migration but I...
2
by: Jerry Spence1 | last post by:
1. Is there a more suitable, dedicated newsfeed for VB2005 yet? 2. I'm confused as to which version to get. I work for a small company and we will just need VB2005 on my PC. Therefore that tends...
8
by: t | last post by:
In VB6, I usually use objptr function and API copymemory to identify and obtain an object, how can I convert them into VB2005? Your kindly help would be much appreciated.
0
by: Rich | last post by:
Hello, I just upgraded a vb2003 app to vb2005. The vb2003 app had/has a statusbar object - which contains panels and I can see the properties of the statusbar in the properties window in...
2
by: Omar Abid | last post by:
Hi, This the best site where you can find Hi members, We are happy to tell that if you search for : jobs with high wage or to debug a program or to find a good source code and to make a good...
1
by: erickwan88 | last post by:
I am doing a final year project for my school and is going to provide for an organization, so I am asking for some help on here. Indeed, I have no idea on how to get the input from my pen driver...
1
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I...
1
by: Vae07 | last post by:
Ok so here is a brief summary of my problem. I need a pop up form that submits input text box information to a pocket excel workbook upon a command botton click. Text box inputs are checked for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.