|
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
ListBox2.SetSelected(ListBox1.SelectedIndex, True)
End Sub
If there is a chance that the two lists could have differing item counts then use the Try Catch block to avoid selecting an invalid index.
Good luck!
It was broke, so I fixed it.
|
|
|
|
|
Unfortunately a WinForms ListBox does not offer scroll events, so the only technique I'm aware of is by overriding its WndProc. Here[^] is an example (it is using C#, you can do the same in VB.NET).
Once you got scroll events, you can have the second ListBox mimic the scrolling of the first. You can also do it both ways, but then you probably need to be careful and avoid eternal loops.
|
|
|
|
|
Hello,everyone! I've knowan how to click treenode to make tabpages selected and show, but I don't want users could click the tabpage and selected one of them. I searched in internet and found that it should use a intenger such as "tab = 1" in some Tabcontrol and Tabpage events like this webpage said whick use TabPage1_Validating & TabPage1_Enter like below :
Private Sub TabPage1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TabPage1.Validating
If tab = 1 Then
e.Cancel = True
Else
e.Cancel = False
End If
End Sub
Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Enter
tab = 1 ' setting the selected tab when user gets back to this tab
End Sub
I tried it and now the tabpage could not click,but when I clicked treenode, it could not selected tabpage too.In fact,I didn't understand how the code in the webpage made tabpage disable click after I looked up in MSDN...
Could anyone give me some suggestions and help? Thanks a lot!
|
|
|
|
|
Why not just scrap the TabControl and use a stack of Panels instead?
|
|
|
|
|
Is there a Gecko Layout Engine .net Module? I want to have my web browser use the gecko layout engine, but I don't know how I can make that happen other than if there were a .net module for it. Thanks.
|
|
|
|
|
there is a tool called "google"
enter the terms:
gecko .net
press the "search" button and .... something wonderful will happen
|
|
|
|
|
I have done that and yet I haven't found anything on it, so I was hoping to get a reply from someone that has used something like it, so I can use that too... Your reply was rude, and I don't appreciate it.
|
|
|
|
|
maybe you did it ... but you didn´t read the page ....
a few lines below the "main" article you would have found a reference to geckofx .... and that is what you (probably) need.
to moan about a correct, short info as "rude", will prevent a lot of people to answer you in the future.
|
|
|
|
|
thebiostyle wrote: I have done that and yet I haven't found anything on it,
Here[^] it is
There doesn't seem to be a .NET specific library.
I are Troll
|
|
|
|
|
Hi, I was wondering if anyone knew if there was a way to output bytes through a comm port in a HEX format rather than ASCII using the SerialPort control or any other method.
Thanks,
|
|
|
|
|
A serial port can transmit arbitrary byte values (i.e. binary data) as well as textual data.
The former is supported by methods such as SerialPort.Read() and Write(), the latter by ReadChar(), ReadLine() and more.
Not sure what you mean by "HEX format". Is it just binary data? use Read/Write! Is it text according to some specific format (such as Intel Hex, Motorola S-records, whatever), build your string and send it, or receive your string and decode it.
|
|
|
|
|
I have an application "app1" which create a UDP socket with port no. 6677.This app broadcast a data packet.
I hav another application "app2" which also create UDP socke which always listen 6677.Whenever the data packet comes it do certain operations.
Now problem is , when I run these to apps on different machines in the network, app2 detects the data packet.But when I run both the applications on the same machine,app2 never detects the data packet.
What may e the problem???
UDP socket related code in app2 is pasted here....
wsClientRecieve.RemotePort = 6677
wsClientRecieve.RemoteHost = "127.0.0.1"
wsClientRecieve.LocalPort = 6677
wsClientRecieve.Bind 6677
Thanks in adv..
|
|
|
|
|
I don't know the answer to your problem, however, I always start by asking myself: would I be the only one with such a problem? when not, I try google[^]. There sure are some interesting hits, such as this one[^]. Good hunting!
|
|
|
|
|
jainiraj wrote: two UDP socket on the same machine..
Damn, i thought this was the start of a Joke and was waiting for the punchline.
|
|
|
|
|
There once were two UDP sockets entering a bar. The bar tender says... I don't know any socket jokes, sorry.
|
|
|
|
|
The first one said:
- Hey, man, yesterday I asked Mary to marry me.
- And what did she say?
- Errr... I don't even know if she was listening...
Yep, this is UDP.
|
|
|
|
|
That is why SMS is more suited for the occasion I guess.
|
|
|
|
|
Ok, I have done something similar and got it working
I "think" the answer is that your localport on the "client" app should be 0 to allow it to use another port to connect from, I use .connect rather than .bind, I don't know enough to say whether this is because I am using vb6
basically only one process can create/bind port 6677 on a given PC and other processes have to connect to it. If you are indeed trying to create the socket in both processes the second create should fail
|
|
|
|
|
I have an excel file, I want to get the file name and store it in a cell.
How to do this?
Thanks in advance.
modified on Friday, November 19, 2010 4:48 AM
|
|
|
|
|
2 seconds of Googling found this[^]. You're going to kick yourself when you see how easy it is.
|
|
|
|
|
Thanks a lot.
The link was very useful.
|
|
|
|
|
Range("A1").value=ThisWorkbook.FullName
or
ActiveCell.value=ThisWorkbook.FullName
|
|
|
|
|
Thanks a lot for the code.
It gave me a part of the solution.
I would also like to know how to remove the extension of the Name.
code used:
Private Sub Workbook_Open()
Range("AK4").Value = ThisWorkbook.Name
End Sub
output:F28900035.xls
how to remove the extension from this Name.
Thanks in advance.
|
|
|
|
|
That's pretty simple too!
You just have to use the replace function.
For example
Dim str as String
str=ActiveCell.Value
Range("A2").Value=Replace(str,".xls","",1)
Cheers!
|
|
|
|
|
Thanks a lot for that piece of code.
It worked perfectly.
In the same way how to get the username/HostName of a system in a cell?
Thanks in advance.
|
|
|
|