I've inherited code similar to the following with a comment on resetting the
string. Why would anyone want to do this? How could this reset the string?
What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
End Sub
--
Regards,
-Ron 6 2080
RNeely,
To make his program unreadable for his coworkers and to make himself very
interesting.
Cor
"RNEELY" <RN****@discuss ions.microsoft. comschreef in bericht
news:7F******** *************** ***********@mic rosoft.com...
I've inherited code similar to the following with a comment on resetting
the
string. Why would anyone want to do this? How could this reset the
string?
What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
End Sub
--
Regards,
-Ron
Ron,
There could be any number of reasons someone would want to reset a
string, which only means putting it back to its original value.
If the string is used as a global variable that must default to a
certain value, but utilized to temporarily hold a new value that is
referenced somewhere else, then you would want to reset it after it is
referenced.
But, as Cor so eloquently pointed out, the example code is total
nonsense. Is this a true representation of the code in question?
Tom
RNEELY wrote:
>I've inherited code similar to the following with a comment on resetting the string. Why would anyone want to do this? How could this reset the string? What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventAr gs) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
End Sub
Yes, the representation is accurate. Thanks for the sanity check. The
assignment of s = sOriginal seems superfluous because it is superfluous.
Don't know if this code was perhaps cut and pasted from inside a for loop?
Doesn't matter. It is still superfluous.
--
Regards,
-Ron
"tomb" wrote:
Ron,
There could be any number of reasons someone would want to reset a
string, which only means putting it back to its original value.
If the string is used as a global variable that must default to a
certain value, but utilized to temporarily hold a new value that is
referenced somewhere else, then you would want to reset it after it is
referenced.
But, as Cor so eloquently pointed out, the example code is total
nonsense. Is this a true representation of the code in question?
Tom
RNEELY wrote:
I've inherited code similar to the following with a comment on resetting the
string. Why would anyone want to do this? How could this reset the string?
What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
End Sub
"RNEELY" <RN****@discuss ions.microsoft. comschrieb:
I've inherited code similar to the following with a comment on resetting
the
string. Why would anyone want to do this? How could this reset the
string?
What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
's' and 'sOriginal' always contain the same value because 'sOriginal' is set
to the value of 's' and the value gets reassigned to 's'. I suggest to
remove 'sOriginal'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
tomb ha scritto:
Ron,
There could be any number of reasons someone would want to reset a
string, which only means putting it back to its original value.
If the string is used as a global variable that must default to a
certain value, but utilized to temporarily hold a new value that is
referenced somewhere else, then you would want to reset it after it is
referenced.
perhaps they meant:
Dim s As String = Nothing
Dim sOriginal = s
SetTheStringToS omething(s)
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
But, as Cor so eloquently pointed out, the example code is total
nonsense. Is this a true representation of the code in question?
Tom
RNEELY wrote:
I've inherited code similar to the following with a comment on resetting the
string. Why would anyone want to do this? How could this reset the string?
What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
End Sub
RNEELY wrote:
I've inherited code similar to the following with a comment on resetting the
string. Why would anyone want to do this? How could this reset the string?
What does it mean to reset a string?
Public Sub SetTheStringToS omething(ByRef OutStr As String)
OutStr = "123"
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim s As String
SetTheStringToS omething(s)
Dim sOriginal$ = s
s = sOriginal 'reset the string ' <- why? how?
Debug.WriteLine (s)
Debug.WriteLine (sOriginal)
End Sub
Another possiblity for you.
This may be a hang-over from a [much] earlier VB Type-ing problem.
If the Sub's /original/ declaration were
Public Sub SetTheStringToS omething(ByRef OutStr)
Then (in VB) it would return a Variant /containing/ a String (and in
VB.Net an /Object/ containing a String).
Since sOriginal$ is explicitly Typed as a $tring, this may be an attempt
to /remove/ the Variant wrapper and get the value back in to a proper
String variable.
Regards,
Phill W. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: spike |
last post by:
My prygram goes through a string to find names between '\'-characters
The problem is, parts of the name in sTemp remains if the new name is
shorter than the old name.
code
---------------------------------------------------
char sTemp;
char sText = "THELONGESTNAME\\samantha\\gregor\\spike\\..."; // and
so on...
|
by: Roger Withnell |
last post by:
I need to reset a form to its original value using onclick rather than the
Reset button. So, I have:
<input type="button" name="reset" id="reset" value="Reset"
onclick="form1.reset();"> where the id of my form is "form1".
This gives the error "Object doesn't support this property or method".
Please advise.
|
by: Jordan Tiona |
last post by:
How can I make one of these? I'm trying to get my program to store a string
into a variable, but it only stores one line.
--
"No eye has seen, no ear has heard, no mind can
conceive what God has prepared for those who love him"
1 Cor 2:9
|
by: ILCSP |
last post by:
Hi, I have a sql table containing the answers for some tests. The
information in this table is presented vertically and I need to create
strings with them. I know how to read the data in VB.Net and use a
StreamWriter to build the strings. However, the problem lies with the
reading of each row.
Most of the test takers don't give answers to ALL of the items in a
test, but those unanswered items need to be accounted for by using a
comma...
|
by: Derek Hart |
last post by:
Is there an efficient line of code to count the number of instances of one
string within another.
If I have the sentence:
"I want to go to the park, and then go home."
It would give me a count of 2 for the word "go"
Derek
| |
by: bevis |
last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you can.
I'm using Eclipse 3.2.2 and I have installed mysql-connector-java-5.0.6-bin.jar. I am trying to connect to SQL Enterprise Manager version 8.0 innstall on a Windows 2003 Server Enterprise Edition.
I have been able to successfully test...
|
by: Giovanni D'Ascola |
last post by:
Hi.
I noticed that <input type="reset"actually don't enable checkbutton
which are checked by default after they have been disabled by
javascript. It's a bug?
|
by: raylopez99 |
last post by:
I see that String and StringBuilder in C# / C++ do not have an easy
way to set a string to null or zero length, once it is instantiated.
Apparently some variant of the .NET languages do (reading between the
lines from another fragment I found).
So the problem is to do this quickly (of course it can be done in a
roundabout manner), using either StringBuilder or String. I'm using
C#.NET version 2.0 (Visual Studio 2005). It looks like...
|
by: vikas251074 |
last post by:
I am getting error above in following code since few days giving tension day and night.
How can I solve this? I am facing since Oct.25. in line no. 362
After doing a lot of homework, I am surrendered to you.
<%@ Language=VBScript%>
<%Option Explicit%>
|
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...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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();...
|
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
| |
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...
| |