|
Hi,
1.
when you reply to your own message nobody gets notified, it is only by accident that I saw this. Didn't you get a MessageBox warning you?
2.
you don't need the List at all, this should work:
For Each item As String In ListBox1.Items
If ListBox1.SelectedItems.Contains(item) Then
' do something with the selected item (it should not change the ListBox)
Else
' do something with the unselected item (it should not change the ListBox)
Endif
Next
|
|
|
|
|
I actually do get an error saying that list has changed. It also says something about an enumerator. Does'nt make sense to me.
Here's the code:
For Each item As String In ListBox1.Items
If ListBox1.SelectedItems.Contains(item) Then
MessageBox.Show(item & "|" & True)
Else
MessageBox.Show(item & "|" & False)
End If
Next
I only get one messagebox for the first item, wether its selected or not, but then i get that error.
Virtual Space Shuttle Astronaut
|
|
|
|
|
Hi,
sorry I didn't know this, it seems one cannot iterate both Items and SelectedItems like that at the same time.
I did come up with this code, which works fine:
Private Sub ListBox1_SelectedValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged
Dim s As String = ""
For i As Integer = 0 To ListBox1.Items.Count - 1
Dim item As String = ListBox1.Items(i)
If ListBox1.SelectedItems.Contains(item) Then
s = s & " +" & item
Else
s = s & " -" & item
End If
Next
Label1.Text = s
End Sub
|
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hi, dear all,
I have a project created in VB.net 2005 and I will collect some user input data based on user selection for calculation.
Since the input data number and content are different based on user selection, I have problem about how to layout these input fields.
For example, the SpeedContrlType is a combobox with value 1,2 and 3, for different value, the set of input data is totall different. If user select value 1, I will show data for type 1 and hide data for other 2 types, same for type 2 and 3.
Can you give me some suggenstion how to organize the form for this case? I don't want to show all data at the same time, then if user select type 1, enable type 1 data set and disable other two sets.
Thanks a lot!
|
|
|
|
|
Andraw Tang wrote: Can you give me some suggenstion how to organize the form for this case? I don't want to show all data at the same time, then if user select type 1, enable type 1 data set and disable other two sets.
The easiest option is to put the UI for each type into Panel . Hide panels number 2 & 3 by default, and switch visibility if the user changes the type.
A better choice would be to move it to a UserControl
I are Troll
|
|
|
|
|
Eddy,
Thank you for your reply.
If I use panels to hold data, I should overlap these panels and make one of them visible according to user selection, right?
What did you mean to move it to UserControl? I am new to VB.net, can you give me more explanation? it's best if you can give me some sample.
Thanks again!
|
|
|
|
|
Andraw Tang wrote: If I use panels to hold data, I should overlap these panels and make one of them visible according to user selection, right?
Yup. It would be easier to put them next to each other in the designer, and to move them to the correct location when the form is loaded.
Andraw Tang wrote: What did you mean to move it to UserControl?
A UserControl resembles a blank panel, and is used if you need to build your own controls. Imagine that you're using a Panel over and over again to display a picture and the name of the user. You could copy/paste that code and the panel, or you could create a new control;
Public Class MyPanel
Inherits System.Windows.Forms.UserControl
Public Name As String
End Class
This new control can contain anything you like. There's a walkthrough[^] on MSDN if you want to give it a try
I are Troll
|
|
|
|
|
Eddy,
Thanks, I will take a look.
|
|
|
|
|
I'm moving from Ms Access to vb.net/Sql Server. I'm looking for a sample project that includes a vb.net front end and Sql Server back end. There is plenty of sample code out there, but I havn't found any complete applications.
|
|
|
|
|
I'm not sure if you can find complete application, but there are plenty sample codes. What is wrong with sample codes?
|
|
|
|
|
I'm very new to programming, and I'm probably not much of a natural at it, although I enjoy it thoroughly. I learned what I know about Ms Access from "reverse engineering" an application(as well as reading books of course).
I just purchased a book Murach's ado.net vb2008, it has a good amount of sample applications so hopefully it will help.
|
|
|
|
|
soulrebelpd wrote: I learned what I know about Ms Access from "reverse engineering" an application(as well as reading books of course).
I'm not sure how much you can learn from reverse engineering alone. Not to mention the amount of time you will spend in understanding the code.
soulrebelpd wrote: I just purchased a book Murach's ado.net vb2008, it has a good amount of sample applications so hopefully it will help.
Good for you. Books are good source of information. Also consider taking a class. It may accelerate your learning curve.
|
|
|
|
|
|
|
Hi Everybody,
Is there any other process to register dll other than regsvr32 process. If yes please let me know.
Thanks in advance,
Jayachandra
|
|
|
|
|
An actual COM .DLL or a .NET assembly? Are you sure it's a COM-base .DLL? Library .DLL's cannot be registered.
The only other way to do it would be to poke the registry values in by manually, but that's not a good idea at all.
|
|
|
|
|
maybe ...
google this:
programmatically register activex dll
|
|
|
|
|
hello
I'm inheriting a legacy VB COM component - I tried register the component:
regsvr32 SomeMatlabUtil.dll
(The folder contains SomeMatlabUtil.tbl as well in same folder)
But I ran into the error:
SomeMatlabUtil.dll was loaded, but the DllRegisterServer entry point was not found.
We're deploying this on 64 bit WIN2003 machine. Need some help on this...
Thanks
dev
|
|
|
|
|
devvvy wrote: SomeMatlabUtil.dll was loaded, but the DllRegisterServer entry point was not found.
Sorry to state the obvious but if the entry point is not found in the dll then it cannot be registered. I'm not a COM expert so I'm not sure offhand how you get round this, but I'm reasonably certain you can link to unregistered COM dlls.
It's time for a new signature.
|
|
|
|
|
yes very obvious, so how to check if we're missing an attrib to decorate entry point or what? obvious fix/cause?
dev
|
|
|
|
|
As I said, I'm not a COM expert but I would guess you need to look at the source code.
It's time for a new signature.
|
|
|
|
|
Use
Register
[FrameworkPath]\REGASM SomeMatlabUtil.dll /tlb SomeMatlabUtil.tlb
Unregister
[FrameworkPath]\REGASM /unregister SomeMatlabUtil.dll /tlb SomeMatlabUtil.tlb
|
|
|
|
|
Thanks very much guys
dev
|
|
|
|