|
Do NOT cross post in multiple forums. I makes collaborating on an answer near impossible.
|
|
|
|
|
I have found a code from the net, but its not working properly.
It is related to UDP socket creation.
Senario is like when we click on "send data" button a "hello" string should pass from client to server which are on the same machine.
Problem is when I click on "send data" button it gives an error-
code is-
Private Sub Form_Load()
' Set the control objects when the form loads.
Set wsClient = Me!axWinsockClient.Object
Set wsServer = Me!axWinsockServer.Object
' Set the protocol for client and server.
wsClient.Protocol = sckUDPProtocol
wsServer.Protocol = sckUDPProtocol
' Set the host and ports for client and server. Because client
' and server are the same computer in this example, set RemoteHost
' equal to LocalIP.
wsServer.RemoteHost = wsClient.LocalIP
wsServer.RemotePort = 1007
wsClient.Bind 1007
End Sub
Private Sub CmdSend_Click()
' Send a broadcast message from the server.
wsServer.SendData "Hello"
End Sub
Private Sub axWinsockClient_DataArrival(ByVal bytesTotal As Long)
Dim strServerMsg As String
' When a message arrives from the server, display it in a text
' box.
wsClient.GetData strServerMsg, vbString
Me!Text1.Value = strServerMsg
End Sub
Here axWinsockClient and axWinsockServer are the socket control or winsock on the same form. and "hello" string should be print in text box.
On debugging I found it is not calling axWinsockClient_DataArrival() method.
What may be the problem.
Thnks in adv..
modified on Friday, September 3, 2010 8:11 AM
|
|
|
|
|
You left out the most important part of the question. WHAT'S THE ERROR YOU'RE GETTING??
|
|
|
|
|
|
Perhaps you should post what the error was and what you did to fix it so that other people with the same problem can benefit from your post
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Give him a break, he was just reminded about errors.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I wasn't trying to be sarcastic, but someone could actually benefit from it
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Somehow, I doubt it. If all it took was to read the eorror message, I think the solution was obvious from whatever the message was.
|
|
|
|
|
Yeah good point, sorry
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
|
No I am not going to click a suspicious link.
See if you can crack this: fb29a481781fe9b3fb8de57cda45fbef
The unofficial awesome history of Code Project's Bob!
"People demand freedom of speech to make up for the freedom of thought which they avoid."
|
|
|
|
|
Hi, dear all,
I create a database using Access database.
There are some fields with data type Yes/No, I want to know to tell the difference of Null and False.
Right now even if I never set value for these field, they return false to me. I wants to clarify the difference.
I use the following code, but doesn't work, suppose I have a field called Marriage which is type Yes/No.
if user never fill in value for it, it should return Null, otherwise, return true or false
Dim obj as Object
obj = ResultSet.Tables(0).Rows(0).Item("Marriage")
If IsDBNull(obj) Then
return Nothing
ElseIf obj.ToString() = "True" Then
return True
Else
return False
End If
it always reutrn "False" to me.
Thanks!
|
|
|
|
|
I hope you were smart enough and googled your question. an adequate suggestion is readily available.
|
|
|
|
|
I search from google first, but didn't find any answer.
|
|
|
|
|
for decimal data type, everything is ok, only for Yes/No data type, if you didn't set value for it, it return False to you.
|
|
|
|
|
That is correct; if you don't like it, use something else.
|
|
|
|
|
In my program there is a function that loops through a list of files, opens each file, reads the contents, and then needs to output an excel file that contains the data plus additional notes that is determines from the data. The loop is something like this (overly simplified though)
Private Function ProcessFiles()
Dim FilesToProcess as List(Of String)
PopulateList(FilesToProcess)
For Each item As String in FilesToProcess
Dim fs As New FileStream(item)
Dim Data As String = fs.ReadToEnd
...
...
...
Next
End Function
In my program this is probably the function that takes the longest to complete and I feel that it might benefit from parallelization and would like to run some benchmarks. However I'm having trouble understanding how to implement the parallelization.
From what I've gathered so far I might be able to do something like this:
Private Function ProcessFiles()
Dim FilesToProcess as List(Of String)
PopulateList(FilesToProcess)
Parallel.ForEach(FilesToProcess ???)
Dim fs As New FileStream(item)
Dim Data As String = fs.ReadToEnd
...
...
...
Next
End Function
Not sure how to write the rest of the Parallel.ForEach . Any help would be greatly appreciated. Thanks in advance.
|
|
|
|
|
You can do this, but since you're using Excel in this loop, you may have just stopped this from working. You'll have to test to see if you can do this work in Excel from multiple threads at the same time. I don't think it'll work, but that's what testing is for...
|
|
|
|
|
I am creating Excel files, but I'm not using Interop. I have a third-party library that will let me create Excel files without Excel being installed on the workstation so this shouldn't be a problem.
|
|
|
|
|
if the individual jobs are not related, i.e. have no common resources (files, variables), then it should be really simple. You may want to read an article on Parallel class, such as this one[^] (examples are in C# though).
|
|
|
|
|
That is a great article. Don't know why through all my google searches it never came up. Much appreciated!
|
|
|
|
|
For Microsoft's related stuff, I always do a search directly on MSDN ; it seems that MSDN site's indexing by search bots is not very effective.
|
|
|
|
|
Dear all,
In my program using vb.net, it involves a lots of data (about 300), when generate report, we don't need to list all, so user need to choose from these data for output to report.
These 300 data is divided into 30 table, I am look for a better way to organize these data.
At first I am thinking create an excel file that list all these data, one in a row, and next to the data create a checkbox, protect all except the checkbox, so when user click "Select Output List", I will launch the excel, let user select data, save and close it, then from my program I will read the selection from excel file, but the clients don't like it. They don't want extra file. they want everything is inside the VB form.
I am new to VB.net, is there better way let me handle this issue?
Thanks!
|
|
|
|
|
why would you need an external program to do part of the overall job? can't you just show the data and the checkboxes on a Form (maybe using a DataGridView, a ListBox, or whatever Control you like), let the user select the data items, and proceed?
|
|
|
|
|
Luc,
Thank you for your quick reply.
I have 30 tables, If I use DataGridView to display them, can I merge some rows to make it looks like that the data is grouped by talbe? and also did you mean put all the 300 data in a DataGridView with a scrollbar? I also think about this, but I thought it's too crowded.
Can you give me more explaination? Thanks!
|
|
|
|