473,320 Members | 2,110 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,320 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 2571
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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

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.