473,327 Members | 1,952 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,327 software developers and data experts.

Condition Format in Multiline Textbox

I have implemented a procedure to cycle through text boxes on a report
and apply color formatting based on the name of the control.

Here is the code I used:

On Error Resume Next

Dim ctl As Control
Dim intBranchPosition As Integer
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If Mid(ctl.ControlName, 4, 3) = "Div" Or Mid(ctl.ControlName,
4, 3) = "Reg" Then
Select Case CDec(Left(ctl.Value, 5))
Case -4.99 To 0
ctl.BackColor = vbGreen
Case -7.99 To -5
ctl.BackColor = vbYellow
Case Is < -7.99
ctl.BackColor = vbRed
End Select
If ctl.BackColor = vbWhite Then
ctl.BackColor = vbGreen
End If
End If
End If
Next ctl
The above procedure works great except on a group of text boxes that I
have formatted to display the output on multiple lines. The control
source for the textbox would output something similar to the following:

Branch Name
-7.51%

How would I grab only the percent value so that I could format that
according to code I used above?

Thanks.

Jason

Nov 13 '05 #1
1 2558
Nevermind, I figured it out. Used the Instr function and all is well.

Dim intBranchPosition As Integer
If Mid(ctl.ControlName, 4, 3) = "Bnc" Then
intBranchPosition = InStr(1, ctl.Value, "-")
Select Case CDec(Mid(ctl.Value, intBranchPosition, 5))
Case -4.99 To 0
ctl.BackColor = vbGreen
Case -7.99 To -5
ctl.BackColor = vbYellow
Case Is < -7.99
ctl.BackColor = vbRed
End Select

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
7
by: Joel Finkel | last post by:
Folks, I have a form that has several TextBoxes, some of which have the TextMode set to MultiLine. Each is pre-loaded with data from a database. The user is allowed to modify each entry. The...
2
by: Enzo Marinelli | last post by:
Hello everyone I have a MultiLine TextBox, as follows <asp:TextBo Id="StreetAddress Rows="4 Runat="Server TextMode="MultiLine Width="100%"/
4
by: AWesner | last post by:
For readability sake I’m going to first state that: LF = Line Feed CHR(10) CR = Carriage Return CHR(13) Since Rich Text Format is a standard formalized by Microsoft Corporation I get to ask...
3
by: frank | last post by:
please help! How to keep the format of the content of a MultiLine TextBox. For example, 'new line' I try the code: ------------------------------ TextBox.Text = "TERANET / MPAC - KEY TERMS...
2
by: Mike | last post by:
I am trying to write a little program for my own use using VB2005 express edition. I have a list of peoples names in a file that I read into an array of strings. I am using a multiline textbox to...
1
by: dingcai | last post by:
Hi, I am a learner for C# and .Net. I load XML document as follows: <?xml version="1.0" encoding="UTF-8"?> <CustomerData> <Transaction> <DSLFIELDS> <ID>89</ID> <ADDR>94458</ADDR>
7
by: Anil Gupte | last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net. However, I cannot for the life of me figure out how to write to a multiline textbox. Basically, I have created an array of...
2
by: Nathan Sokalski | last post by:
I have a multiline TextBox that I want to display the text used to create a control in an apsx file. I want each of these to be on a separate line in the TextBox. The only way I know of to place...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.