473,704 Members | 5,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2592
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_TEMPLAT E 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_TEMPLA TE, 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","Singl e 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_TEMPLAT E, "Crouchie")

Console.WriteLi ne (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_TEMPLAT E = _
"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.WriteLi ne _
(MESSAGE_TEMPLA TE, "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_TEMPLA TE, "SINGLE TRIP", "EUROPE", "FAMILY")
Console.WriteLi ne (Message)
--
Tom Shelton [MVP]
Nov 21 '05 #8
Hi Tom.

Of course.

:-)

Cor

Public Class Example
Private Const String MESSAGE_TEMPLAT E = _
"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
1827
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 protocol argument for each time it's called. (This is in Python 2.3.3.) I have a pickle containing two objects: a tag string and a (large) object containing many children. The identifying string is there so that you can unpickle it and...
5
8991
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 around with random() and decided to write a script to generate random dotted quad IP addresses, just to see if I could do it. Everything is perfect with the glaring exeception of the output. It seems
8
2357
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 - the included file depends on the language. Atm I'm editing those file manually. Luckily atm it's only two languages I have to work with, but even in this case I forget to add a variable that I added in the other file, forget to use entities .....
1
3416
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 would like to open C++ file streams due to easier exception handeling and safe closure of file ressources. Question 1: I open a standard file stream and want to transfer some binary read bits
122
5297
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) { /* array differs from value, do something*/
1
2611
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 seems to work on my Intel compiler but is it portable? e.g. #include <iostream> #include <iomanip>
7
4187
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, the program tracks when notifications are sent out and who sends them. Currently these notifications are all sent via email. Now the program users also want the ability to send these notifications via standard snail mail. (I'll make a popup...
3
2030
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 writes in a dialog box without mixing my code with some monstrous class library such as in Qt4, or for Windows Microsoft's class libraries. The details of this implementation should not matter for this question. The only thing that matters is that...
14
12809
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 case it's a question, i want to popup a messageBox or something, and bring back to the batch file the result (Yes\No question). I know how to excute the batch file and get all the Standard output at the end, but i don't know who can i read it line by...
0
8766
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
9271
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
9025
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
7887
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
6604
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
4438
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4699
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3134
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2078
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.