473,756 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Which is a better method to concatenate large blocks of text?

In a Windows Form application, which is the better method to concatenate
large blocks of code?

1. Reading the text from text files.
2. Adding the text to the VB file itself?

Thanks!
J.S.

--
Nov 21 '05 #1
14 2369
J.S.
In a Windows Form application, which is the better method to concatenate
large blocks of code?
Can you explain more with concatentate large blocks of code?

1. Reading the text from text files.
2. Adding the text to the VB file itself?

That depends on what you are doing, you can even add by instance adding the
text from a database.

Cor
Nov 21 '05 #2
> Can you explain more with concatentate large blocks of code?

I am trying to create a Windows application in VB 2005 beta that has a form
with some textboxes. The values entered in the textboxes are variables
which I want to integrate with some other blocks of code (which I have) to
generate code for another application. So the code thus generated would be
based on concatenating some blocks of code (say for example, ASP code) with
the variable values entered by the users. I have managed to do this two
ways - by inserting the blocks of code also in the VB file, and by pulling
the blocks of code from external text files on my computer.

My question is: which of these methods is better from a performance and
"best practices" standpoint? If I integrate all the code into the VB file
then users will just need an .exe file to work with my application. If I
pull blocks of code from external text files then I'll have to create text
files on their computers as well when my assembly is unzipped by them.
That depends on what you are doing, you can even add by instance adding
the text from a database.


You are right; a database would be a good method in many instances. In this
application, however, I'd rather use one of the above methods unless there
are significant reasons not to do so. The reason I use text files in one
method is because I don't know if I could convert the text files into some
kind of binary and still have it be read by my application.

Thanks for your help; I am a complete newbie at this.

J.S.
Nov 21 '05 #3
J.S.

I definitly would not do it with the exe file. If you have no problem that
the user can see the file, than probably (if I understand you well), I would
go for the XML dataset because that is terrible easy to handle.

In VB 2005 it should also be possible to use direct the datatable XML for
this

I hope this helps.

Cor
Nov 21 '05 #4
Hi Cor,

That is exactly what I was looking for. Thanks for your kind advice.

J.S.

--

"Cor Ligthert [MVP]" <no************ @planet.nl> wrote in message
news:Ol******** ******@TK2MSFTN GP12.phx.gbl...
J.S.

I definitly would not do it with the exe file. If you have no problem that
the user can see the file, than probably (if I understand you well), I
would go for the XML dataset because that is terrible easy to handle.

In VB 2005 it should also be possible to use direct the datatable XML for
this

I hope this helps.

Cor

Nov 21 '05 #5
On 2005-08-21, J.S. <js*@nospam.com > wrote:
Can you explain more with concatentate large blocks of code?


I am trying to create a Windows application in VB 2005 beta that has a form
with some textboxes. The values entered in the textboxes are variables
which I want to integrate with some other blocks of code (which I have) to
generate code for another application. So the code thus generated would be
based on concatenating some blocks of code (say for example, ASP code) with
the variable values entered by the users. I have managed to do this two
ways - by inserting the blocks of code also in the VB file, and by pulling
the blocks of code from external text files on my computer.

My question is: which of these methods is better from a performance and
"best practices" standpoint? If I integrate all the code into the VB file
then users will just need an .exe file to work with my application. If I
pull blocks of code from external text files then I'll have to create text
files on their computers as well when my assembly is unzipped by them.


Performance-wise, pulling from a text file is going to be slower, but
I seriously doubt that the difference is going to be significant, so I
really wouldn't worry about that at all.

Contra Cor, I also don't like the idea of datasets for this. That's just
going to make your input files difficult to read and difficult to edit.

Also, by "inserting the blocks of code in the VB file", do you mean
defining them as strings? If so, I also don't like this idea, since
long string blocks are really hard to read.

There's the third choice here, which is to add the text files to
your project and embed them in the applicatio as embedded resources.
I'd lean towards this for a few reasons: a) they're still text files,
and so they're easy to edit, b) they're easy to version and there's no
chance of the wrong version of a text file winding up with the wrong
version of your app, c) installation stays simple since you still have
just the one exe file.

Nov 21 '05 #6
> Contra Cor, I also don't like the idea of datasets for this. That's just
going to make your input files difficult to read and difficult to edit.

Can you explain this?

In my opinion XML datasets are extremely easy to read, to use the data and
to edit, therefore I should miss something?

Cor
Nov 21 '05 #7
"dfoster" <df*****@woofix .local.dom> wrote in message
news:sl******** ************@lo calhost.localdo main...
Performance-wise, pulling from a text file is going to be slower, but
I seriously doubt that the difference is going to be significant, so I
really wouldn't worry about that at all.
Thanks!
Also, by "inserting the blocks of code in the VB file", do you mean
defining them as strings? If so, I also don't like this idea, since
long string blocks are really hard to read.
Yes, that's what I meant. For example:

Textbox1.Text = "Some code" &_
"Some more code" & Var1 &_
"Lots more code" & Var2 &_
so on and so forth
There's the third choice here, which is to add the text files to
your project and embed them in the applicatio as embedded resources.
I'd lean towards this for a few reasons: a) they're still text files,
and so they're easy to edit, b) they're easy to version and there's no
chance of the wrong version of a text file winding up with the wrong
version of your app, c) installation stays simple since you still have
just the one exe file.


I have been looking at embedded resources. There I two questions I am
wondering about this:

1. Is it correct that at design-time the text files would be separate but
would be embedded into the .exe file when the assembly is built?

2. If the text files are going to remain embeddeed in the .exe and not be
unzipped then how would I change the path for the text file in my VB file?

For example, now I have something like c:\textfile.txt . If I want to read
text from an embedded text file the path must be something else since there
will be no separate textfile.txt at run-time.

Thanks,
J.S.
Nov 21 '05 #8
I found some information about resources here:
http://msdn.microsoft.com/library/de...yResgenexe.asp

--

"J.S." <js*@nospam.com > wrote in message
news:ua******** ******@TK2MSFTN GP15.phx.gbl...
I have been looking at embedded resources. There I two questions I am
wondering about this:

1. Is it correct that at design-time the text files would be separate but
would be embedded into the .exe file when the assembly is built?

2. If the text files are going to remain embeddeed in the .exe and not be
unzipped then how would I change the path for the text file in my VB file?

For example, now I have something like c:\textfile.txt . If I want to read
text from an embedded text file the path must be something else since
there will be no separate textfile.txt at run-time.

Nov 21 '05 #9
On 2005-08-21, Cor Ligthert [MVP] <no************ @planet.nl> wrote:
Contra Cor, I also don't like the idea of datasets for this. That's just
going to make your input files difficult to read and difficult to edit.

Can you explain this?

In my opinion XML datasets are extremely easy to read, to use the data and
to edit, therefore I should miss something?


Often that's true, but remember the OP is dealing with code blocks here.
Long bits of (presumably) VB code in text files. Text files with VB
in them are easy to edit, you just load them into an editor and you get
syntax coloring, autoindentation , maybe even some intellisense depending
on what's in the file.

Move them into a DataSet Xml file though and all that goes away.
The editor won't recognize the text file as VB, and you'll have to deal
with entities for all invalid characters. And code blocks tend to have
quite a few '>' and '<' characters in them.

Nov 21 '05 #10

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

Similar topics

6
2162
by: lastusernameleft | last post by:
i've been researching this issue for a while and can't come to any conclusive answer, mostly it seems to be a preference over syntax, some saying c# is elegant while vb is clunky, or that c# is geeky while vb is more naturally legible. there dont seem to be many capabilities in one over the other, at least with whidbey, so basically, is there anything c# can do that vb can't?
14
1659
by: Blue Ocean | last post by:
My c++ text tells me that I should define methods this way: class Stack { int method(double t); Stack(int s); ... } int Stack::method(double t)
106
5241
by: cfmortgagepro | last post by:
Hi, I know that I'm an extreme newb by asking this overly beaten question, but I am leaning toward C#, becuase the perception is that it is better to learn than VB.Net. I guess it makes you cooler.:-) Anyhow, I am a novice programmer, and I will remain one as well...I have no plans to make programming my life ambition, but I think that it would be fun to make my databases do some cool tricks and maybe write a simplistic client to...
47
1979
by: Dickson Woo | last post by:
Just that.
9
1388
by: David Helgason | last post by:
I'm calling one stored procedure with a prepared statement on the server with 6 arrays of around 1200 elements each as parameters. The parameters are around 220K in total. This is taking a surprising amount of time. Thus I put a lot of logging into the application and in the stored procedure that's getting called. It seems that almost all of most of the time is spent before the stored procedure is even entered. What wakes my suspicion...
15
3194
by: Rob Meade | last post by:
Hi all, I have a databse which I'm pulling the data from for my ASP page. I have 4 tables, Course, Feature, Objective, and PreRequisite. The last three all contain a course product code and a text column - the course product code links the row(s) to the Course table. So, I might have 1 entry in Course, but perhaps 3 in Feature, 5 in Objective and 2 in PreRequisite.
23
2382
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to follow for creating a program? I am writing a map game program. I created several objects: board object that is an array of integers each number 0-5 is a kind of terrain, a terrain object that is an array of terrain types and each number of...
7
13177
by: lister | last post by:
Hi, I have a situation where I have a large block of HTML code that is conditionally displayed. In effect I have: html page some html <?php if (bShowBlock)
1
1834
by: WebCM | last post by:
I'm looking for a good idea or ready library for templates. HTML with PHP isn't the best solution (it's more difficult for end-users of CMS to edit them). Perhaps, everything I need is: - variables - e.g. {var} - sections or conditions (some elements won't be printed out) - loops or selecting fragments* - cache (recommended for speed) The template system must be fast and efficient. Most probably I will create own library for CMS...
0
9456
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
9275
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
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
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
9713
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
8713
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
7248
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
6534
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();...
0
5142
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...

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.