473,805 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem outputting to text box using VBA

119 New Member
This is probably a very easy question to answer:

I have been outputting some text to a message box, similar to the following:

Expand|Select|Wrap|Line Numbers
  1. strOutput = "---" & Chr(10) & Chr(10)
  2. strOutput = strOutput & "VAR:" & AddTabs(1) & Format(rsVar![VAR], "currency")
  3. strOutput = strOutput & Chr(10) & Chr(10)
  4. strOutput = strOutput & "Position Value:" & AddTabs(1) & Format(rsVar![ValuePosition], "currency") & Chr(10)
  5. strOutput = strOutput & "Position Risk:" & AddTabs(1) & Format(rsVar![valueRisk], "currency") & Chr(10)
  6. msgbox(strOutput)
Which works fine. I tried outputting the same string (strOutput) in a text box on a form, i.e.:
Expand|Select|Wrap|Line Numbers
  1. txtBox.caption  = strOutput
The problem is that rather than creating new lines using chr(10), small boxes appear.

Does anyone know an equivalent to chr(10) that will work when sending a string to a text box?
Jun 2 '08
12 13432
Stewart Ross
2,545 Recognized Expert Moderator Specialist
(Sigh) It takes longer to write a reply than it does for the thread context to change, hence I sent then deleted a message which was out of context of the changed thread.

The last poster makes the point that a listbox control can be used to output columns. It can, but with limitations - there is not much in the way of alignment that can be done, for instance. And it does not answer what you need for output via e-mail. I would suggest using a text export which is tab-delimited or using CSV format to output your columns, rather than trying to do this in the message itself. This would be an attachment task, but at least has the advantage that tabs delineate columns, whereas otherwise the interpretation of tabs depends entirely on the application.

In my experience e-mail applications do not do a good job of tabbing, as they impose defaults in the same way as word processors do - arbitrarily. Some columns line up, some don't as they miss the tab point concerned. Some spill into the next column, and so on.

-Stewart
Jun 3 '08 #11
NeoPa
32,579 Recognized Expert Moderator MVP
You could try using spaces to format your output. Many text processors use this method even now, especially when no default context is defined. Alternatively, using the same approach, you could use a character other than the space for tabulation formatting (characters frequently used for this include . - _ = * + etc).

PS. Thanks Stewart for that clarification. You translated my message perfectly :)
Jun 4 '08 #12
billelev
119 New Member
Thanks for the clarification.

The original context was within an email, wherein a tab character moved in multiples of six character spaces, to the nearest multiple. This made the formatting of the table using tabs a reasonably trivial task. I'll probably try using spaces to format the text within the text box.
Jun 4 '08 #13

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

Similar topics

7
1963
by: Cezary | last post by:
Hi. I want to change language on my site online. So, I wrote this: <form action="<?= preg_replace("/&/", "&amp;", $_SERVER) ?>" method="post" name="change_lang_form"> <p style="display:none;"><input type="hidden" name="change_lang" value="1"> <label for="lang" accesskey="l">== <?= CHOOSE_LANG ?> ==</label></p> <p class="margin"><select id="lang" name="lang" class="langsection" onChange="if (this.options.value != 'null')
5
2821
by: Andrei Pociu | last post by:
I have a major doubt about outputting text in ASP .NET when using code behind. I know most of the output you gain from a code behind file (.aspx.cs) is outputted to the Webform (.aspx) using labels, datagrids, datalists... Also, I know you can output directly using Response.Write(). But this places the output at the beginning of the file. How can you output the text at a specific place in the HTML code? An example would be when...
5
4500
by: Lyle A. Sieren | last post by:
Hello! Is there a way to output text in a unix format from vb.net? I am trying to complete a CIM load in Progress and I need the data to be in unix format. I tried using the following code but it left me with a line carriage return in the file (0d0a) outfilew.Write(group6) outfilew.Write(Environment.NewLine) Note:
1
7373
by: Bishman | last post by:
Hi, I have been trying to get text to scroll smoothly accross a windows form using GDI+ and a timer. Changing the position of the text by a configurable amount and calling invalidate to force a redraw at various intervals ( based on the timer ). The text is not moving that smoothly, it seems very jerky, no matter what combination of timings and pixel amounts to move so I have looked at other code and posts and they all seem to have the...
3
1687
by: xiaawan | last post by:
Hi Everyone . I am having problem with text align in CSS. I am using <li> element. I want to display text centered vertically i.e. it should be at equal distance from top and bottom. sorry for my bad english. thanks in advance.
3
1601
by: nskclr | last post by:
Hi I add a text using document.selection.createRange(). I want to add a text to the bottom of another text - similar to what we do in HTML. <p> xyz </p> <p><div style="position:relative;bottom:30px;">abc</div></p> How can I achieve that using javascript?
1
1029
by: NosherRees | last post by:
I'm using GraphicsPath to draw text onto a graphics object (PictureBox). My graphics object has been scaled so that the top left corner is 400000, 6000000 and the bottom right corner is 400100, 5999900. If I draw text directly to the graphics object using DrawString then the text comes out fine, however If I first add my string to my GraphicsPath then use the FillPath method of the graphics object the same text is displayed with very poor...
5
1332
by: padmaneha | last post by:
How to omit replacement in somepart of text using regular expression? For ex: If i want to replace mumbai with mumbai/aaa.com but if i have an anchor tag <a href="/mumbai/bbb.com>mumbai</a> then in the anchor tag too the replacement takes place which should not be done.. How to solve this problem?
1
1303
by: u8dmtm | last post by:
I want to output XML from an ASP.Net page and have created the code below: using System; using System.Data; using System.Configuration; using System.Collections.Generic; using System.Linq; using System.Web; using System.Data.SqlClient; using System.Xml;
0
1249
by: Sirus86 | last post by:
problem with text and image.Text is overlaying or moving to below image. i design is very complex and i need to include a scroll within the design. this is what i have so far div id="content" > <table background="images/Layer-7.png" width="677" height="311" alt="content" class="pngimg" /> <tr> <td> Lorem ipsum dolor sit amet, consectetur adipiscing elit. In a est magna, vel tincidunt nulla. Maecenas ligula enim, pretium id porta...
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10607
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10104
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.