|
Hi
I always use the function 'selecteditem' of a listview to check what the selected item is. This works fine when there is something selected in the list .. when there are for example no entries it crashes on it.
Code:
This crashes when there is no entries in listview:
msgbox lstArtikels.SelectedItem().Text
how can i check if there are still entries in the list?
|
|
|
|
|
Anonymous wrote:
msgbox lstArtikels.SelectedItem().Text
You can use SelectedItems.Count to see how many items are selected, then you can put up the Message Box:
If lstArtikels.SelectedItems.Count > 0 Then
For X = 0 to lstArtikels.SelectedItems.Count - 1
MsgBox lstArtikels.SelectedItem(X).Text
Next
End If
RageInTheMachine9532
|
|
|
|
|
One of the Best Software Consulting Company in New Jersey looking for IT Professionals to join the company on H1B and sponsor Green card immediately with labor is 3-4 months timeframe, and we have Offices in different locations.
We offer Best Billing rates to the consultants, if you have project in your hand you will get maximum portion of the Billing Rate completely negotiable. You will get Bonus when you refer a friend or associate to the company.
No Rejection/Query in the entire company history for H1/Greencard sponsorship.
We are direct vendors to IBM, Pearson Education, and Verizon etc.
We are also looking for consultants who have skilled in Data Warehousing, .NET & J2EE Technologies, SAP and Oracle Apps etc. We are ready to sponsor H1s and Green Cards.
YOU CAN CONTACT ME AT keith_002@hotmail.com.
|
|
|
|
|
Hi
I am a software consultant presently working on .NET technologies. Pls email me for further details.
Thanks,
Keshav.
|
|
|
|
|
Ok this is my first post here. So Im admitting im a new bee ok How would I allow my app to run behind a Firewall and NAT????
I am not able to turn it off and I fell others sould not have to also or port forward but lets say with a code like this as a example I got from here
Also how about set it up to use random port would that have to do with.. Private Shared port As Integer = 44 ????
Thank you for any help ZoodayZ...
Imports System
Imports System.Net
Imports System.Net.Sockets
Imports System.Text
Public Class StateObject
Public workSocket As Socket = Nothing
Public BufferSize As Integer = 32767
Public buffer(32767) As Byte
Public sb As New StringBuilder()
End Class
Public Class SocketsClient
Public Event onConnect()
Public Event onError(ByVal Description As String)
Public Event onDataArrival(ByVal Data As Byte(), ByVal TotalBytes As Integer)
Public Event onDisconnect()
Public Event onSendComplete(ByVal DataSize As Integer)
Private Shared response As [String] = [String].Empty
Private Shared port As Integer = 44
Private Shared ipHostInfo As IPHostEntry = Dns.Resolve("localhost")
Private Shared ipAddress As ipAddress = ipHostInfo.AddressList(0)
Private Shared client As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Public Sub Connect(ByVal RemoteHostName As String, ByVal RemotePort As Integer)
Try
client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
port = RemotePort
ipHostInfo = Dns.Resolve(RemoteHostName)
ipAddress = ipHostInfo.AddressList(0)
Dim remoteEP As New IPEndPoint(ipAddress, port)
client.BeginConnect(remoteEP, AddressOf sockConnected, client)
Catch
RaiseEvent onError(Err.Description)
Exit Sub
End Try
End Sub
Public Sub SendData(ByVal Data() As Byte)
Try
Dim byteData As Byte() = Data
client.BeginSend(byteData, 0, byteData.Length, 0, AddressOf sockSendEnd, client)
Catch
RaiseEvent onError(Err.Description)
Exit Sub
End Try
End Sub
Public Sub Disconnect()
Try
client.Shutdown(SocketShutdown.Both)
Catch
End Try
client.Close()
End Sub
Public Function StringToBytes(ByVal Data As String) As Byte()
StringToBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Data)
End Function
Public Function BytestoString(ByVal Data As Byte()) As String
BytestoString = System.Text.ASCIIEncoding.ASCII.GetString(Data)
End Function
Private Sub sockConnected(ByVal ar As IAsyncResult)
Try
If client.Connected = False Then RaiseEvent onError("Connection refused.") : Exit Sub
Dim state As New StateObject()
state.workSocket = client
client.BeginReceive(state.buffer, 0, state.BufferSize, 0, AddressOf sockDataArrival, state)
RaiseEvent onConnect()
Catch
RaiseEvent onError(Err.Description)
Exit Sub
End Try
End Sub
Private Sub sockDataArrival(ByVal ar As IAsyncResult)
Dim state As StateObject = CType(ar.AsyncState, StateObject)
Dim client As Socket = state.workSocket
Dim bytesRead As Integer
Try
bytesRead = client.EndReceive(ar)
Catch
Exit Sub
End Try
Try
Dim Data() As Byte = state.buffer
If bytesRead = 0 Then
client.Shutdown(SocketShutdown.Both)
client.Close()
RaiseEvent onDisconnect()
Exit Sub
End If
ReDim state.buffer(32767)
client.BeginReceive(state.buffer, 0, state.BufferSize, 0, AddressOf sockDataArrival, state)
RaiseEvent onDataArrival(Data, bytesRead)
Catch
RaiseEvent onError(Err.Description)
Exit Sub
End Try
End Sub
Private Sub sockSendEnd(ByVal ar As IAsyncResult)
Try
Dim client As Socket = CType(ar.AsyncState, Socket)
Dim bytesSent As Integer = client.EndSend(ar)
RaiseEvent onSendComplete(bytesSent)
Catch
RaiseEvent onError(Err.Description)
Exit Sub
End Try
End Sub
Public Function Connected() As Boolean
Try
Return client.Connected
Catch
RaiseEvent onError(Err.Description)
Exit Function
End Try
End Function
End Class
|
|
|
|
|
zoodayz wrote:
How would I allow my app to run behind a Firewall and NAT????
I am not able to turn it off and I fell others sould not have to also or port forward but lets say with a code like this as a example I got from here
Also how about set it up to use random port would that have to do with.. Private Shared port As Integer = 44 ????
Are you telling us that the code you included in your post is the server running behind the Firewall/NAT? If so, then you MUST use port forwarding to get to the server from the WAN side of your router. Since there is no direct IP route between the Internet and your local network, the router must be told what ports on the WAN side of the router to forward to which server (IP and port) on the local side. Therefore, you can't use a random port number, unless your app is going to reconfigure the router every time the port number changes.
RageInTheMachine9532
|
|
|
|
|
I am writing a vb.net windows app that can be called from a scheduler or run
as an application.
How do I set a return or exit code for the application.
i.e 0 if successfull or 1 if not.
Thank you
|
|
|
|
|
It is possible do this by setting the App Startup to Main startup, instead of a form. You can do this in the Project Properties. But, you must add a class to the project and add a main function something like this:
Function Main() as Integer
The this main must start the first form in your program, if you have one.
You can use the help in Visual Studio or on MSDN and search for "Structure of a Visual Basic Program" to find an example.
RageInTheMachine9532
|
|
|
|
|
Thanks I read this and picked up alot.
It works though if anyone is curious the VS.IDE debugger always
returns a 0 in that window. I had to use the windows scheduler
to see the return code.
Thats again
|
|
|
|
|
how can i developpe an client/server application with vb.net, the client and the server are a winform and may give and take some informations in "datatables" "dataset"....
is it like java ?? may i use port, sokets...
thanks
|
|
|
|
|
It sounds like you're starting brand new to VB.NET, yes?
If so, you may want to review the QuickStart tutorials for WinForms. It's a good place to start.
http://samples.gotdotnet.com/quickstart/winforms/[^]
If you're looking for socket-type programming, the .NET Framework contains classes in the System.Net namespace that you can investigate. If you're looking to create a Client/Server database application, you may be fine with the ADO.NET support in the Framework. The QuickStart tutorials introduces ADO.NET.
|
|
|
|
|
I have a listview in details mode, and I want to be able to double click on it and a varaiable return with the information that I click on.
Is this possible?
Thanks in advance
Code_Gopher
|
|
|
|
|
Would something like this work? (Assuming a control on the form called ListView1)
Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles ListView1.DoubleClick
'-- get the item selected following the double-click
Dim sel As ListViewItem
sel = ListView1.SelectedItems(0)
'-- display the selected item text
If Not (sel Is Nothing) Then
MessageBox.Show(sel.Text)
End If
End Sub
|
|
|
|
|
Hi,
I'm relatively new to vb .net. Right now I'm working on a project where actual database is in SQL Server. But the "Access Project" file has been created to connect to SQL Server database.
I can not connect to SQL Server directly, basically no one has access to SQL Server directly. So if we need to access it we have to go thru the access project that have been created.
I'm using vb .net to create an application that involves this database, but I dont know how can I connect to "access project" file to access SQL Server database using vb .net???
Is it at all possible? can u guys help me with this?
shatru2k
|
|
|
|
|
Why cant you connect directly to the SQL server?
IT Admins?
|
|
|
|
|
well, first of all I dont have rights to access a server machine where the sql server database is... so i have to go to thru this machine here they have set ms access project...
and secondly this is what a client has requested to do... I can ask him if it is not at all possible to connect to sql server via access project in vb .net
|
|
|
|
|
I'm trying to automate some tasks using VB/VBA. I would like to do something similar along the lines of the article found here:
http://www.codeproject.com/tools/VssReporter.asp
More specifically, I would like the click a 'Browse' button within a Word document that would have a VSS explorer (or something like that) window come up. I am able to access the basic ssapi.dll methods, but am lost beyond the basics. Any help would be much appreciated.
|
|
|
|
|
I have some incredibly large insurance quote forms that are too big to render properly on older computers or computers on a dial-up. What is the best way to break-up the form to make it user-friendly? (similar to Geico or Progressive) Thanks for the help
rjcarney
|
|
|
|
|
I have a little application I've been developing, and it moves a set of controls around a panel using drag and drop. If the panel is set with AutoScroll as enabled, the controls can be dragged out of the default visible area. However, when the control is dragged back slightly closer to the default area, it leaps suddenly and the scroll bars vanish (when there are no other controls, otherwise they stay, but all the other controls outside of the default area fly past as the control 'leaps' to the default area.
Has anyone heard of this / encountered this? Most oblidged!
|
|
|
|
|
How can I control the IExplorer-Bar (Tip Of The Day) from within HTML or JavaScript/VBScript?
Is there a way to active or deactive this pane per combinationkey?
Thanx a lot.
Nortorfer
|
|
|
|
|
Even though I have administrator rights under a particular domain, I'm not able to register any dlls which are necessary for running a web-site. But I am able todo the same using a local admin username & password. why is it so? how can I rectify it.
Shenthil
|
|
|
|
|
That is because the account your using has admin rights to the website, NOT the server it's running on. You need at least Power User privileges to install software on the server, this includes registering controls and .DLL's.
RageInTheMachine9532
|
|
|
|
|
Hi,
I have administrator rights. Still, I have this problem.
Shenthil
|
|
|
|
|
You posted in you first message that you're using an account that has admin rights to the domain. Is this account a member of the machine's Administrators local group?
RageInTheMachine9532
|
|
|
|
|
Thanks a Lot.
Thats where the problem was.
|
|
|
|