|
Here is the code using Array.Copy, although it's probably easier to create a loop and copy all elements in an array except the one you want to delete.
Dim str As String = "This is my original string"<br />
Dim originalArray() As String = str.Split(" ")<br />
'now to remove the fourth word: (index 3)<br />
Dim indexToRemove = 3<br />
Dim newArray(originalArray.Length - 2) As String<br />
Dim numElementsToCopyFirst = indexToRemove 'copy everything up to index right before the element to be removed<br />
Array.Copy(originalArray, 0, newArray, 0, numElementsToCopyFirst)<br />
Dim numElementsToCopySecond = originalArray.Length - indexToRemove - 1<br />
Array.Copy(originalArray, indexToRemove + 1, newArray, numElementsToCopyFirst, numElementsToCopySecond)<br />
'now replace original array<br />
ReDim originalArray(newArray.Length - 1)<br />
Array.Copy(newArray, originalArray, newArray.Length)
|
|
|
|
|
hey guy, you will have to be more clear (2nd time !!!)
where do you get the selected item from ? a combobox ? a listbox ? a datagrid ?
i ask this because an arraylist cannot be displayed directly on a form as it is not a control (it is only a container class).
SO, i understand you want to delete an element from an arraylist with its index, but where do you get its index from ?? (see the question posted previously on this post)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
sorry, the member is select using a next/previous button to switch between members.
So for example when i click next, the textboxes will fill with the info of that particular member; Name, address, postcode, ID etc.
|
|
|
|
|
harrysk wrote:
sorry, the member is select using a next/previous button to switch between members.
ok, so if i well understand (you explaination is not well detailled yet but i start understanding what you mean), you have a textbox that display a part of a list, and you move into that list with Previous/Next buttons. so, if you reach doing this, you also have an index variable to point to the element you want to display, right ?
this way, your index variable is positioned on the current element, agree ?
so, you can do the easy following thing :
Dim MyList As ArrayList
Dim MyIndex As Integer = 0
'You fill your list...
'You use your list...
'Then, you remove the current element :
MyList.RemoveAt(MyIndex)
and that's all...
was is so complicated to find by yourself ? maybe you don't know where to find ?!
well, you go to the MSDN, filter by Visual Basic, then search for ArrayList (its the members), so read there what seems to answer to your problem...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
hi all,
i'm having a problem in my web application. i'm using vb.net i want to create a table or grid on my webform by clicking a button which is displayed on the webform. and on which i can enter the data. the no of columns and rows will be specified at runtime by the user by entering into textboxes. how do i do this. please help me.
|
|
|
|
|
You should set one datagrid to fill it from databse
then u should have one insert command to get text from textbox-es to datagrid
|
|
|
|
|
How can I control the IExplorer-Bar (Tip Of The Day) from within HTML or JavaScript/VBScript?
Or is there any way to active or deactive this pane per combinationkey?
Thanx a lot.
landsmann
landsmann
|
|
|
|
|
Dear Friends
when I used Picture Box on my MDI form i am unable to open any child form on MDI form. when i remove picture box from the MDI backgeound i can see the child form. please help me to solve this problem
Your quick response will be appriciated.
Thanks
Murtuza Patel
|
|
|
|
|
set the picture as background of you MDI instead, because the picturebox is a control, and controls in the MDI mainframe are displayed upon the childre frame.
another solution is to put a panel control docked on a side of the MDI if you want it to be "split" into 2 parts (1:the picturebox, 2:the child space)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i need a an email validation control box implemented in vb6.. as i saw in vb.net there's a validation control box.. can it be implemented in vb6 so that i can verify the email address .. before saving it in to the data base
|
|
|
|
|
There's no equivalent control in VB6. You'd have to write it yourself. You can use the Regular Expression library that comes as part of Windows Scripting to make your life a bit easier. There's all kinds of RegEx strings that'll validate an email address for you.
I don't have any example code, because I stopped using VB6 when .NET was in Beta...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
- In such case u can use the .NET 'RegularExpression' in VB6.0 through the COM Interop.
- Using the 'RCW' the .NET Namespaces can be used in VB6 also.
With Regards
|
|
|
|
|
www.dotnetspider.com/technology/kbpages/898.aspx is telling me to bring a refernce .. but can u ppl give me a COM object of the validation control box in .net .. or tell me the url where it's present.. so that i can call it's refernce .. RCW
|
|
|
|
|
hi friends,
My problem is how can i use my barcode judget using PS2 connection.? my project built in Visual Basic 6. Please help me.
|
|
|
|
|
Normally, these things are attached in-line with the keyboard, so any output that comes from the barcode scanner is treated exactly like you typed it at the keyboard. There's really nothing to do...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Barcode scanners usually come as either Serial connection or keyboard wedge. If yours has a ps2 connection it will be of the keyboard wedge type. All the ones i have seen require some sort of setup which is normally done by scanning codes from the book that comes with it (Setting character sets and leading character sort of thing).
What this means is that whenever you scan a barcode the output should appear in whatever application you have open eg notepad, word or even outlook. This means that what you need to do is capture the string into a textbox so typically you could put a mesaage on screen sating "Scan Product" and set the focus to an invisible textbox ready to accept the input (can be invisible if you want but it must have focus).
You will need the setup books or you wont be able to set the character set or set a character to prefix the actual barcode so your application knows there is a barcode.
In general keyboard wedge scanners are pretty easy to set up and use so read the documentation with the device and you should have no problems.
Jonathan
|
|
|
|
|
Here is a combox control in a winform.
I want to select an item of it by code.
How to do ?
Thanks!
vs.net 2005 beta 1
|
|
|
|
|
you have the choice between the following :
MyComboBox.SelectedIndex = 2 'to select the 3rd item in the list
MyComboBox.SelectedItem = AnObject
MyComboBox.SelectedValue = AnotherObject
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I want to initial the value when loading a winform.
Actually , I do not know the Index of then combobox.
I only know the ID and the Name of the combobox item.
|
|
|
|
|
rushing wrote:
Actually , I do not know the Index of then combobox.
but how do you populate it ???
you fill it into the load event handler, then you know the indexes...
or i'm really out of your aim. is so, give a piece of code, otherwise i'll never can help you
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I think this code does your request.
ComboBox1.SelectedIndex = 2
The other properties can not be used as a target of assignment
Ex:
ComboBox1.SelectedValue.ToString() = "choice2" 'Items of ComboBox1 :choice1,choice2..etc..
-MCP& MCAD &junior coder--
|
|
|
|
|
hakanaktan wrote:
ComboBox1.SelectedValue.ToString()
are you sure you can assign a constant that comes from ToString() ???
i don't believe.
Moreover, ValueMember does not contain only strings...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Here what i wrote:
The other properties can not be used as a target of assignment
Ex: (example for the expression at the upperside)
ComboBox1.SelectedValue.ToString() = "choice2" 'Items of ComboBox1 :choice1,choice2..etc..
-MCP& MCAD &junior coder--
|
|
|
|
|
yes but, why don't you write
ComboBox1.SelectedValue = "choice2"
instead of
ComboBox1.SelectedValue<font color=red>.ToString()</font> = "choice2"
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I think it may be a bug of vs.net 2005 beta 1.
|
|
|
|