|
If you perform the following function:
Mid(InputRecord, 99, 5) = ReplacementString It will indeed substring out the piece you dont want and replace it at the same time with the new string.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Odd. It's not documented to do that. Testing in VBA reveals that it will only replace the exact number of characters specified in the original span. Using a different length string will only get cut off.
The closest equivilent in the .NET Framework is String.Replace() . Strings are immutable so any changes you make are not reflected in the original string, but in a copy of the string.
Dim s As String = "This is a test..."
s = s.Replace("is", "was")
The original string "This is a test..." is dropped while the Replace method returns a new string with the changes made.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I've seen people utilize the Mid for that functionality though, and you're right it is a fixed length but that is the intention for where it is used, at least where I currently work. I decided to modify what the other poster said and just do InputRecord = InputRecord.Remove(99, 5).Insert(99, ChangedInputValue) .
I am aware that the strings just create copies but this doesnt seem to be a large enough building scheme to utilize something else and like I said before I cant guarantee that the value at 99 for 5 is unique so a .Replace might have unforeseen consequences.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
It is documented, but there's the Mid function and the Mid statement. They are two completely different things.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
Oh crap. You're right. Shows you hong long it's been since I've touched VB6.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Sorry - did not read your post properly. Nothing I can think of that is as direct. You could use:
Dim s As String = "12345"
s = s.Remove(2, 2)
s = s.Insert(2, "xx") 'Returns "12xx5
I take it String.Replace(oldString, newString) is no good?
Hopefuly someone else posts with a better answer than mine...
|
|
|
|
|
Yes because I cant guarantee that the instance from 99 for 5 is unique.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Then you'll have to build the string back up using the available substring methods. The StringBuilder class would probably come in handy for that and save you from creating more String objects than is necessary.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hello all,
i wanted to have an application, which iclude a button, when clicking on it an existing word file will open in microsoft word.
I tried to add Microsoft Word 9.0 Object Library, from the COM in ADD REFERENCES, but the problem is that i dont have it in the references.
So whats the problem, any thing wrong in the .net i got? any thing wrong in the installation?
Any help is greatly appriciated ....
scorpion
|
|
|
|
|
do u have office 2003 or later installed?
|
|
|
|
|
Sorry for mis-mentioning, am using office 2003.
scorpion
-- modified at 9:34 Wednesday 28th March, 2007
|
|
|
|
|
Did you right-click References in Solution Explorer, Click Add Reference, and look under COM tab for "Microsoft Word 10.0 Object Library"
|
|
|
|
|
if you still dont find it you'll need to install The Office 2003 Primary Interop Assemblies (PIA) ull get them from the micrsoft website , just search for it...
|
|
|
|
|
Sir/Madam,
Can somebody please help me in generation the print preview of my crystal reports in vb.net 2005.
Thanks and regards
Pankaj
|
|
|
|
|
|
i have one doubt....,
see when we are opening a new project in .net,
one global.asax file will be create automatically
what the use of that one?,
there some session start and session end process will be go on
its possible to explain those things...,
any one knows about that share with me......,
Take care....,
Regards,
Magi
|
|
|
|
|
The Global.asax file is in the root application directory. While Visual Studio .NET automatically inserts it in all new ASP.NET projects, it's actually an optional file. It's okay to delete it—if you aren't using it. The .asax file extension signals that it's an application file rather than an ASP.NET file that uses aspx.
The ASP.NET page framework recognizes automatically any changes that are made to the Global.asax file. The framework reboots the application, which includes closing all browser sessions, flushes all state information, and restarts the application domain.
The Global.asax file, which is derived from the HttpApplication class, maintains a pool of HttpApplication objects, and assigns them to applications as needed. The Global.asax file contains the following events:
* Application_Init: Fired when an application initializes or is first called. It's invoked for all HttpApplication object instances.
* Application_Disposed: Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.
* Application_Error: Fired when an unhandled exception is encountered within the application.
* Application_Start: Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.
* Application_End: Fired when the last instance of an HttpApplication class is destroyed. It's fired only once during an application's lifetime.
* Application_BeginRequest: Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.
* Application_EndRequest: The last event fired for an application request.
* Application_PreRequestHandlerExecute: Fired before the ASP.NET page framework begins executing an event handler like a page or Web service.
* Application_PostRequestHandlerExecute: Fired when the ASP.NET page framework is finished executing an event handler.
* Applcation_PreSendRequestHeaders: Fired before the ASP.NET page framework sends HTTP headers to a requesting client (browser).
* Application_PreSendContent: Fired before the ASP.NET page framework sends content to a requesting client (browser).
* Application_AcquireRequestState: Fired when the ASP.NET page framework gets the current state (Session state) related to the current request.
* Application_ReleaseRequestState: Fired when the ASP.NET page framework completes execution of all event handlers. This results in all state modules to save their current state data.
* Application_ResolveRequestCache: Fired when the ASP.NET page framework completes an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.
* Application_UpdateRequestCache: Fired when the ASP.NET page framework completes handler execution to allow caching modules to store responses to be used to handle subsequent requests.
* Application_AuthenticateRequest: Fired when the security module has established the current user's identity as valid. At this point, the user's credentials have been validated.
* Application_AuthorizeRequest: Fired when the security module has verified that a user can access resources.
* Session_Start: Fired when a new user visits the application Web site.
* Session_End: Fired when a user's session times out, ends, or they leave the application Web site.
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
|
|
|
|
|
ya its good......,
but i need some sample codes..,
then its easy to understand...,
like that any site will be there plz tell me..........
Magi
|
|
|
|
|
Hi, Following could be a good site to start with
http://www.123aspx.com/redir.aspx?res=31960
There are many you can find in google like
http://www.google.co.uk/search?hl=en&q=global.asax++msdn+examples&btnG=Search&meta=
Regards,
Jaiprakash M Bankolli
jaiprakash.bankolli@gmail.com
|
|
|
|
|
Hi Everyone
I am developing a business application and wanna to include the facility of transactions in multiple units e.g (Customer can buy a Product in KG as well as in MG or GM).
I am getting difficulties in managing stock if I allow user to apply transactions with multiple units.
If anyone has some experienced in such transactions then please help me in developing this application.
Regards
|
|
|
|
|
I am new to using crystal reports, im creating a report and i have designed some boxes which will contain text taken from the database at runtime. I enabled the "can grow" option of the boxes since the text can vary from being small or large. My problem here is, in my desiging process, i have to draw the maximum box size my text can be which distorts the design over all. What i want is that i draw a small box, enable the can grow option and it grows with the text, but when that happens, the box below the first one is overlapped with its text...how do i avoid this overlapping? i want the boxes below to move along with the text like in a table in word and not to overlapp...or is there a way i can position the boxes at runtime by calculating where they lie??? HOPE TO GET HELP!
|
|
|
|
|
Hi all,
Please help me out to parse the word document using vb6. I have user open command to open word document in binary mode. But the content has ascii charactor merged with the text. Please help me to parse the word document.
Thanks in advance
sushanth
Thanks and Regards,
Sushanth_CP
|
|
|
|
|
You really can't open and parse the Word document this way. The Word doc is a multiple stream format that's VERY complex to interpret. A better option would be to create an instance of Word and have it open the document so you can do what you want to it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello,
I've a Textbox on my form and my locale and regional Language settings are Standard English(UK). I want to allow the Greek characters to be typed and displayed in the textbox(or rich textbox) and at the same time want to get it's KeyValue (like the ascii key value A = 65) so that certain check can be performed. Language being used is VB6
Any Help would be really appreciated?
Jon.
|
|
|
|
|
If I recall correctly there is an asc() function that will give you the number value of letters.
|
|
|
|