472,377 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Mixing VB variables with standard text to output text file

I wish to create a text document (to the users desktop on any machine) which outputs to a standard text file with information obtained from there use of my program... Some of the text will be fixed and some will be variables generated in VB.net. For example...

You have chosen a SINGLE TRIP, which is within EUROPE and is for FAMILY and last for 27 days. The trips starts from 24/04/05 until 30/04/05 and you chose to use more than 17 days of winter sports. The total price for your trip £155.00.

The BOLD CAPS mean they are variables from VB.net.

Any help would be appreciated!!!

Scott
Nov 21 '05 #1
8 2463
Where's the code from your program?

Will the users have a text box to enter the length of time & datetimepickers to select the start/end dates?

Will the program be run locally or from the server?
Nov 21 '05 #2
In article <Ap*******************@newsfe1-gui.ntli.net>, Scott wrote:
I wish to create a text document (to the users desktop on any machine) =
which outputs to a standard text file with information obtained from =
there use of my program... Some of the text will be fixed and some will =
be variables generated in VB.net. For example...

You have chosen a SINGLE TRIP, which is within EUROPE and is for FAMILY =
and last for 27 days. The trips starts from 24/04/05 until 30/04/05 and =
you chose to use more than 17 days of winter sports. The total price =
for your trip =A3155.00.

The BOLD CAPS mean they are variables from VB.net.

Any help would be appreciated!!!

Scott


Const MESSAGE_TEMPLATE As String = "You have chosen a {0}, which is
within {1} and is for {2} and lasts for 27 days. The trip starts from
24/04/05 until 30/04/05 and you chose to use more than 17 days of winter
sports. The total price for your trip is $155.00"
Dim Message As String = String.Fromat (MESSAGE_TEMPLATE, tripVariable,
placeVariable, familyVariable)

Anyway, something like that :) I have a hard time reading you message
because it was in html format - and I only use a text only reader :)

--
Tom Shelton [MVP]
Nov 21 '05 #3
What is the price per day?

Tom,

That format you supplied isn't static text because the variables change,
therefore, you cannot declare it as constant
Nov 21 '05 #4
Hopefully that will read better...

I need to output to a new file that must be created on the desktop... a lot
of the code is pre-fixed with the variables filling in the blanks... The
most important thing is saving to the desktop on any particular machine,
within the network...

Here is the original text I wrote...

I wish to create a text document (to the users desktop on any machine) which
outputs to a standard text file with information obtained from there use of
my program... Some of the text will be fixed and some will be variables
generated in VB.net. For example...

You have chosen a SINGLE TRIP, which is within EUROPE and is for FAMILY and
last for 27 days. The trips starts from 24/04/05 until 30/04/05 and you
chose to use more than 17 days of winter sports. The total price for your
trip £155.00.

The BOLD CAPS mean they are variables from VB.net.

Any help would be appreciated!!!

Scott
Nov 21 '05 #5
Scot,

You mean something as this

"You have chosen a @1, which is within @2 is for @3............"

String1 = String1.Replace("@1","Single Trip") 'probably a datafield.
String1 = String1.Replace("@2 etc)

This is not a quick method however for this small string not slow too, very
easy and good documentative in my opinion.

I hope this helps,

Cor
Nov 21 '05 #6
In article <u7**************@tk2msftngp13.phx.gbl>, Crouchie1998 wrote:
What is the price per day?

Tom,

That format you supplied isn't static text because the variables change,
therefore, you cannot declare it as constant


Yes you can... I do this all the time. It is a template to pass to
string.format.

Try it:
Option Strict On
Option Explicit On

Public Class Example
Private Const FORMAT_TEMPLATE As String = "Hi {0}"

Public Shared Sub Main ()
Dim Message As String = String.Format (FORMAT_TEMPLATE, "Crouchie")

Console.WriteLine (Message)
End Sub
End Class

--
Tom Shelton [MVP]
Nov 21 '05 #7
In article <IG****************@newsfe1-gui.ntli.net>, Scott wrote:
Hopefully that will read better...

I need to output to a new file that must be created on the desktop... a lot
of the code is pre-fixed with the variables filling in the blanks... The
most important thing is saving to the desktop on any particular machine,
within the network...

Here is the original text I wrote...

I wish to create a text document (to the users desktop on any machine) which
outputs to a standard text file with information obtained from there use of
my program... Some of the text will be fixed and some will be variables
generated in VB.net. For example...

You have chosen a SINGLE TRIP, which is within EUROPE and is for FAMILY and
last for 27 days. The trips starts from 24/04/05 until 30/04/05 and you
chose to use more than 17 days of winter sports. The total price for your
trip £155.00.

The BOLD CAPS mean they are variables from VB.net.

Any help would be appreciated!!!

Scott


See my original reply...

Option Strict On
Option Explicit On

Imports System

Public Class Example
Private Const String MESSAGE_TEMPLATE = _
"You have chosen a {0}, which is within {1} and is for {2} and last for 27 days. The trips starts from 24/04/05 until 30/04/05 and you chose to use more than 17 days of winter sports. The total price for your trip £155.00."

Public Shared Sub Main ()

Console.WriteLine _
(MESSAGE_TEMPLATE, "SINGLE TRIP", "EUROPE", "FAMILY")
End Sub
End Class

You could also format it to a string using String.Format...
Dim Message As String = String.Format _
(MESSAGE_TEMPLATE, "SINGLE TRIP", "EUROPE", "FAMILY")
Console.WriteLine (Message)
--
Tom Shelton [MVP]
Nov 21 '05 #8
Hi Tom.

Of course.

:-)

Cor

Public Class Example
Private Const String MESSAGE_TEMPLATE = _
"You have chosen a {0}, which is within {1} and is for {2} and last for 27
days. The trips starts from 24/04/05 until 30/04/05 and you chose to use
more than 17 days of winter sports. The total price for your trip
£155.00."

Nov 21 '05 #9

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

Similar topics

0
by: Erik Max Francis | last post by:
Is there any prohibition against mixing different protocols within the same pickle? I don't see anything about this in the Python Library Reference and, after all, the pickle.dump function takes a...
5
by: tgiles | last post by:
Hi, all. I'm YAPN (Yet Another Python Newbie), started messing with it last night and so far, so good. Documentation exellent and the people seem friendly enough ;) Ok, I started playing...
8
by: Sebastian Kerekes | last post by:
Greetings, I'm developing an application that supports multiple languages. In my XSL I use variables to place the text where it belongs to. At the top of the document I include those variables -...
1
by: Marc Cromme | last post by:
I would like to ask a question about (good ?) style and possibilities in mixing C FILE* and C++ file streams. The background is that I want to use the C libpng library from within C++, but I...
122
by: Einar | last post by:
Hi, I wonder if there is a nice bit twiddling hack to compare a large number of variables? If you first store them in an array, you can do: for (i = 0; i < n; i++) { if (array != value) {...
1
by: Andy | last post by:
Can I mix wide and narrow character output to stdout? I seem to remember hearing this was not supported before but I can't find any reference to such a restriction now I actually need to do it! It...
7
by: Ryan | last post by:
Ok.. here's my situation. I have a program that handles a database full of people. Users of the program have the ability to send out notifications to these people. Pretty standard notifications,...
3
by: rewtedesco | last post by:
I bet that others came across this problem and that there is a very good general solution, however I have not been able to get this done. In short: How to replace std::cout by something that...
14
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.