Use Of Mid(), Instr(), LBound(), UBound() Not Recommended?

Sep 28, 2009

I come from a C# background but am now working mostly with VB.Net. It seems to me that the above functions (and others - eg. UCase, LCase) etc. are carryovers from VB6 and before. Is the use of these functions frowned upon in VB.Net, or does it purely come down to personal preference?

View 4 Replies


ADVERTISEMENT

New Ubound Set, Will Everything After Ubound Be Removed?

Jan 19, 2011

Here is a bit of code I found. It was said to remove a specific value in the array. However, it looks to me like it's setting a new ubound(end to array?), wont everything behind the new ubound be removed too?

Code:MyArray(ItemToBeDeleted) =MyArray(Ubound(MyArray))
RedimPreserve MyArray(Ubound(MyArray)-1)

Edit:Or is it just moving the value to the end and then just -1 from the end to remove it?

View 3 Replies

Erase And Ubound In Net?

Dec 18, 2009

I have some problems. I wantd to convert come vb codes into vb net.

1. I have this VB 6 code:

Public Type ddt
x As String
End Type
I have convertid it in this way:
Public Structure ddt

[Code]...

View 6 Replies

Get The Ubound Of An Array?

May 18, 2011

I've got this 3 piece of code:

For x = 0 To sections.Length - 1
'work
Next

[Code].....

I've been thinking for about 10 minutes but I still can't decide what exactly are the advantages of 1 choice over the other.

I was wondering if anyone has actually given this some thought and would like to share their insights. Basically I would like to know which is "better" (you can quote clarity, easy refactoring, performance, maintainability, good standard, anything that makes it "better")

View 3 Replies

Why One Over Another: UBound Or Length

Sep 1, 2011

Could there be any specific reason why one can choose UBound over Length? Here is the code and 1-dimension is passed as second parameter.

[Code]...

View 3 Replies

Return Decimal Number By Using UBound?

May 6, 2011

want to return decimal number but because of "UBound" its keep displaying as integer how can i display decimal numbers?Public Class frmPrintbooks

Private Sub frmPrintbooks_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For x = 0.0 To UBound(Form1.printBookName)
lstPrintbooks.Items.Add(Form1.printBookName(x) & " " & String.Format("{0:C}", Form1.printBookPrice(x)))
Next x
End Sub

[Code]...

View 14 Replies

User Control Ubound For An Array?

May 23, 2012

bound user control to create an array. in VB6 I have this code which is working fine:

For j = 1 To 10
Load iProject(iProject.UBound + 1)
Next

How to make this work in VB.NET 2010?

View 4 Replies

MS ACCESS - Putting A Query Result Into An Ubound Textbox Control?

Jun 26, 2009

I am working on a custom report in access and I do have a query which I want the outcome to appear in a text box control. Howver when I link this under the control source property, It returns an error.

View 1 Replies

C# - What Is The Recommended Architecture For ASP.NET Web Applications

Jun 3, 2009

In the first comment (by J.W.) to this question: Using ObjectDataSource and DataObjectTypeName, How Do You Handle Delete Methods With Just An Id Parameter?, it is said that using ObjectDataSource is a bad design. What is considered good design for well-architected ASP.NET applications?

View 1 Replies

Use Of MID And INSTR In .net?

Oct 23, 2009

i have a string that looks like this "Patient Name, Doc Name, Patient ID, something else"i want to extract each one of these and put it in a variable. such that var1 will equal "Patient Name" var2 will equal "Doc name" etc.. using instr and mid. what is the best way to do it?

View 3 Replies

C# - Recommended Way To Work With Audio In .NET Applications?

Dec 10, 2009

I'm trying to get started with a simple audio application under .NET 3.5 (preferably in VB.NET, but will happily use C#). What I'd like to do is: Continuously record audio from (the default) Windows audio input device in 8-bits-per-sample PCM format For every N bytes captured, do some analysis on the raw audio (some RMS and/or SPL calculations -- basically what you'd need for a pretty VU bar graph thingy) If the audio fragment is found interesting after analysis, save it using a compressed file format (e.g. MP3)

[Code]...

View 4 Replies

Recommended Approach For Copying Elements

Jan 30, 2010

Which is the recommended approach for copying elements from one control to another? Currently I am using something like this:
For Each a As Control In control.Controls
Controls.Add(a)
Next
Should I stick to it, or should I change to use the ControlCollection.CopyTo method instead?

View 3 Replies

Recommended Practice Is For Importing Namespaces?

Mar 27, 2012

Just wondering what the recommended practice is for importing namespaces. Are you always better importing the namespace like the fisrt snippet of code, or are you better to type the full namespace inline with your code.

I like both methods; the first is tidier and takes less code, the second can identify exactly where your accessing some logic from which can provide some clarity when looking over the code. Just wondering if there are pros/cons for either or if this is just a personal preference, currently I use a combination but would like to keep consistant.

[Code]...

View 2 Replies

.net - Using Instr When String Is Nothing

Jul 29, 2009

I have the following condition

If InStr("a,b,c", stringA) > 0 OrElse (InStr("y,z", stringB) > 0 AndAlso value = 0) Then
endif

COndition 1 is false so i check for condition 2 that is "(InStr("y,z", stringB) > 0 AndAlso value = 0) "

What puzzles me is that when stringB is nothing it still falls into the if condition and executes the code.

On first look it would seem that when stringB is nothing condition2 would fail and as a result would not fall into the if condition.

View 1 Replies

Difference Between Instr And Contains?

Dec 8, 2009

for determining whether a string of data contains certain text, which is more efficient? I have read elsewhere that there is somewhat of a consensus to avoid legacy functions, since they may or may not be available in future versions.However, trying to use the contains method (or indexof equivalent of Instr) is causing me problems, I think, because I am having trouble performing a case-insensitive search.

I am trying to be efficient and functional in my code. I am reading an INI file, and I have preloaded the contents of the file into a String variable, for 2 reasons. 1) If I can test if a certain section exists in the code, I can avoid attempting to read a section of empty data (the INI reader class I have chosen returns the value or an empty string for a given request). More importantly, 2) I have created a data field that is not INI compliant (at least not to the API?) as it is a data field that can contain an arbitrary (unlimited?) amount of data which is a hex-encoded representation of serialized byte data. I need to be able to determine if this value exists in the file and retrieve it using normal string manipulation, since the INI handler will not pass strings longer than 256Chr.

So, the problem I am having is getting "strFileContents.Contains("data=")" to return true in the case where the file contains "Data=". This could be data=, DATA=, DaTa=, etc.Instr has the option "CompareMethod.Text" which, I believe, does a case insensitive text search. What is the equivalent for "Contains"?

View 5 Replies

Element Id's Are All Different / Instr

Mar 12, 2009

I am developing a twitter application. I can add, delete a user but now need to load the users follower page and then add the followers. the problem is the element id's are all different. I have tried the following,, loading the html into a text box and trying to read it using instr. but could not get the instr to parse the element id which looks something like this

[Code]....

View 8 Replies

Master VB By Finding Right Link(recommended) From Microsoft?

Aug 7, 2010

Meanwhile waiting to further study I would like to imporve my programming skill in Visual Basic 2008, I would like to know if anybody knows where is the good link which is from Microsoft to learn and upgrade VB 2008. Mostly I am more interested in Application program specific in Engineering. anybody can show me the link, I am registered user of Microsoft Visual Studio 2008 and I am Microsoft Certified Professional.Website:

View 4 Replies

Recommended Text For The Creation Of Custom Controls?

May 1, 2009

I was wondering if there is a recommended text for the creation of custom controls? I know a few years ago this book was out: Developing Microsoft .NET Controls with Microsoft Visual Basic .NET (Pro Developer)

It was published in 2003 I think. I have a great deal of experience in VB but not in actual control development, so I don't need a primer on classes and properties and the like. Wondering if this would still be worth it? I never dove into this part of VB and .NET before.

View 2 Replies

How To Use RegEx Expression With InSTR

Jan 13, 2011

I'm looking to do is scrub an html file for anything that resembles an IP address or any set of numbers for that matter. Normally what I would do is just using things like string.split to split out the html around areas that I want to search. What I am looking to do is be able to essentially search a large amount of characters for anything that matches this reg ex pattern.

Dim pattern As String = "^(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]).(d{1,2}|1dd|2[0-4]d|25[0-5]):(d{1,4}|[0-5]dddd|[0-5]dddd|6[0-4]ddd|65[0-4]dd|655[0-2]d|6553[0-5])$"

View 1 Replies

InStr' Is A Namespace And Cannot Be Used As An Expression?

Oct 24, 2010

'InStr' is a namespace and cannot be used as an expression.Dim FirstString As String = "me@me.com"

Dim SecondString As String = "@"Dim position As Integer position = InStr(FirstString, SecondString)
If position = 0 Then MsgBox("Not a Valid email address: There was No @ Sign") End If

View 1 Replies

Using A Variable As String 2 In InStr?

Aug 16, 2011

Is it possible to use a string for string 2? cuz whenever i tried it would return a 0 instead of the position of the string. however when i hard code the string into the code it works

View 7 Replies

File I/O And Registry :: Recommended Shared User Space?

May 29, 2010

My program requires the reading and writing to a file that is shared among all users of a system. Currently I keep this file (an XML configuration file) in the directory that my application is installed to, which is C:Program FilesSomething by default. On Windows 7 (and probably XP too, but I haven't checked), regular users cannot write to this file. While I could probably set permissions as needed in my installation program, I'd rather find a more appropriate place for this file.All users need to read and write to it. Doing some Googling turns up C:ProgramData for Windows 7, but XP doesn't create this folder. Is there a common place on both platforms? Finally, is there an environment variable I can query for it?

View 2 Replies

Standard/Recommended Approach For Using Child Form Of A Parent?

May 2, 2011

The basic setup is this: VB.NET application, using Windows.Forms, a parent form is shown and the user interacts with that. Now, I want to show a child form, modally, configure that form with data from the parent and have the user interact with that child form and then return information to the parent code.Here is one approach that I have used, but it is a bit awkward. Parent has this code:

Dim cf as Child_Form
Dim initdata(3) As Byte
' Set up initdata[code].....

View 2 Replies

Using InStr To Replace A Character From A String

Jan 21, 2011

What i am trying to do is take a character (which is going to be into a variable by user input) and search a string for this character, and save the positions of all character found and then change the same position of these characters in another string for the character that the user inputs. In other words, like a guess a word game. User tryes a guess, i search the string for that letter or number, if it's there replace it on the text box of the GUi, if not save it in another variable as a character that has been tried already, possibly an array.

View 1 Replies

VS 2008 Search Combobox Using Instr?

Jan 30, 2010

I am creating a movie player which lists movie files from various folders/subfolders in a combobox (tsFileList). I'd like to be able to enter the movie name into a textbox (txtSearch), find that text in the combobox (using instr), then automatically select the found item.I'd like to use instr as some of the items in the combobox contains full file paths.

View 3 Replies

VS 2010 Search Multiple With Instr

Nov 19, 2011

I created a code that allows me to search inside a RichTextBox...Then the code is as follows:[code]Now with the code that I use today, the MsgBox show me only the first, ie "<b> text1 </ b>" while others are not..

View 15 Replies

Manipulate Looping Serialport.readexisting And Instr?

Jun 27, 2011

i try readexisting and instr function as follow:

[code]...

View 1 Replies

Assign The Value Of The Integer Returned From The InStr Method To A Variable

Jul 21, 2009

I want to assign the value of the integer returned from the InStr method to a variable. So, If TextBox2.Text = "The Apple Pie" And TextBox1.Text = "App", I want the integer returned, which in this case would be 5, put into a variable, lets say its called 'VarString'.
So VarString (would) = 5.

[Code]...

View 6 Replies

Instr Function Handle Multiple Strings To Find?

Aug 1, 2010

I'm using this for a single value to search for.

intPositionOfApartment = InStr(StrConv(pStringToParse, vbUpperCase), "APT") Is it possible to search for more then one value such as "APT", "UNIT" ?

If yes please show me an example of how it should be coded.

View 4 Replies

Search For New Line Position In A String Variable Using InStr

Aug 7, 2009

I have an application in VB.NET which gets string data from the database. This string has data which looks as below:

"This is the update: I have an issue with the application"

I need only part of the data, that comes after the new line i.e. "I have an issue with the application".

For this I am trying to search the position using InStr where the string has data in a new line. I tried many options, but they don't work.

I used "vbCrLf", Chr(13), "
", "
", "<br/>", Environment.NewLine, but none of them work.

How can I get the data I need?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved