Mr.M 89 Future Programmers

I've managed to solve this problem. For someone who mite experience the same problem, the solution is, you need to index the socket threads as each thread will handle each client. To brake it down, when a client connects to a server you need to index that client so that you will have a sort of array clients on one winsock control so to be able to send messages to a particular client only no matter how many clients are connected, you need to send the response within the DataArrival block at least worked for me and you need to send the message like this:

 Winsock1(Index).SendData("your data here")

The (Index) will send the message to the requested client only.

Here is the perfect link for this:

http://www.devx.com/vb2themax/Article/19879/0/page/2

Mr.M 89 Future Programmers

Hi Dw.

I'm creating a multi-client/server program. I have developed both client and server the server will connect up to 3 clients simultaneously and each client may send an action request to a server at anytime and the server should be able to reply to only that particular client, at the moment suppose I'm having this hard coded: a clients will send a username and will wait a bit so that a server will receive the username and assign it to a variable then the client again will send the password up on receiving the password same process will take place where the server will assign the password to another variable to free up the variable I used to read the dataArival so that the data won't be mixed up, up on receiving (now note this the server here should like use an ip combined with port number for client to keep track of the client sending the data so that the clients data won't be mixed, will be easily tracked, suppose after client 1 sent a username then client let's say 2 sends its username to the server, at the moment the server will take the client2's username as a client1's password and will assign it as a password so what I want is that it should detect that now client2 has sent its username so it should also assign the client2's username on another variable for client2 username while still waiting for client1's password, and client2's password too.)

Mr.M 89 Future Programmers

Why don't you add two buttons one name it < Previous and another one name it Next > and start coding, since you know the location it will help to name your pictures something like img0, img1, img2, and so on so that it will be easy to open the previous and the next picture.

To do so you will need to perform the count and preview the image according to the count. Check this example:

 'Declare this as a Global variable
 Dim No As Integer

 ' Put this under the Next Button
 No = No + 1
 PictureBox1.Image='imageName & No

 ' Put this under the Previous button
 No = No - 1
 If No = 0 Then
 btnPrevious.Enabled = False()
 PictureBox1.Image='imageName & No

This is just an example on how to view pictures and switch around them. Before trying with images that's are within the MyResources try with one on your maybe Drive "D:\" or any drive.

Mr.M 89 Future Programmers

Meant the start day is 2015/03/15 and end date is 2015/03/16 will it give you 2015/03/17?

Mr.M 89 Future Programmers

I'm a bit confused with your code, 2015/03/16, 2015/03/18, 2015/03/20, 2015/03/21.

Also let's say in your text box for start booking is (2015/03/16) and end date is (2015/03/16) are you saying it will give you 2015/03/17 ?

Please try en-lighting us there.

Mr.M 89 Future Programmers

This question is obvious, "What can I do to Unhandled exceptions" obvious your application won't run if you unhandle exceptions so you need to handle it, there are quite a number of samples, tutorial guides out there on the net gloogling could have given you lots of them, and the question you should be asking is "how to" handle exceptions.

As being said the "Try" statement or method will help you with handling your exceptions.

Mr.M 89 Future Programmers

Please quote the "For" statement or codes that searches for dates, so that we will check why this is happening.

Mr.M 89 Future Programmers

Thanks but I've already found the solution.

Mr.M 89 Future Programmers

Also refer to this post here for more info on dice rolling.

 stackoverflow.com/questions/26522868/dice-roller-for-any-sided-dice-in-vb-net
Mr.M 89 Future Programmers

Are you going to write '500' for 500 companies or are you going to write up to 500 'companies'? And so is the other data too or? Please elaborate there.

Mr.M 89 Future Programmers

@Paul seem straight forward, but I didn't see where after the end time has been reached where you remove the booking from the database to support your statement "In order to make new room booking you need to get no records returned"

Just asking because I didn't see you mention the removal of expired booking so that there will be no record returned for that particular room.

Mr.M 89 Future Programmers

Try using 'For' statement to increment starting from 0 upwards

Mr.M 89 Future Programmers

What you mean by flexible?

Mr.M 89 Future Programmers

Hi Dw

I have created a program to lock files and by default when a file is locked the file changes from being a folder to a lock. So what I want to do is to change the lock to my own image, just like how VLC do, it changes all the MP3 files to VLC icon if VLC is installed as a default media player so I want to do the similar thing too.

Thank you.

Mr.M 89 Future Programmers

Try to verify if the variables that host data to be updated to a database do return or hold something, mean check if they are not null, because it seems as if one or more variable has no data within it, its null.

Mr.M 89 Future Programmers

Can you capture the error in debug mode so we can see which line produce the error.

Mr.M 89 Future Programmers
 My.Computer.FileSystem.WriteAllText('your text file name here', 'the return that you display as message here', True)

That should also work.

Mr.M 89 Future Programmers

If you have already verified the date then you will also need to verify the times as well so for instance suppose you also have a field to hold the time a current guest will leave the apartment then you can check the time and then if you wish to give certain time maybe 30 min or 1 hour for room cleaning the you can determine this by retrieving the time of the current guest checkout then from that time add up the desired time needed for cleaning then that will give you the exactly time the room will be available then you can verify the time the second guest is booking the room if its equals or greater then the room availability time at that day of first guest checkout.

Mr.M 89 Future Programmers

Or retrieve the dates and match with the current dates to see if the booked room is available or not.

Mr.M 89 Future Programmers

This will depend on how you insert your vote into database, mean the structure.

Mr.M 89 Future Programmers

Ok I've figured out the error I had to change the IDs from 0 to 22 but I still didn't find my wifi adapter tried all but still the adapter wasn't turned off or disabled because at the moment it is enabled.

Is there perhaps another way to either get the adapter's ID or enable/disable the adapter with other method other then ID?

Mr.M 89 Future Programmers

Error with error message: Invalid method Parameter(s)

Mr.M 89 Future Programmers

Also I had a problem writing the code that was provided by the WMI Code Creater how do I write it, mean is it a class or?

Mr.M 89 Future Programmers

Thanks. I now have a question on how can I embed or call this on my project where I have added a button to disable and another button to enable the adapter mean how do I put this within my project?

Do I have to make this as Function then call it on button click or?

Thank you again.

Mr.M 89 Future Programmers

Hi Dw

Is there a way to disable/enable a selected NIC adapter using vb.net?
Thank you.

Mr.M 89 Future Programmers

Thank you.

about the part where I wrote wrong the variable it was went wrong when I copied the code from my VS and pasted here and started removing some other things then I didn't notice that it ended up that way. But thank the problem was that I needed to put the '' so I just did as you said them boom the record is deleted.

Thanks.

Mr.M 89 Future Programmers

Hi Dw

I'm having a problem in deleting a record in Access database. The error that is thrown is:

No value given for one or more required parameters
What I'm tying to do is to find a record by a name and also delete the record by name instead of using the ID I just don't want to include the ID even on my database but even if I remove the ID field on my database the error still occures. Here is the code that I'm trying to use to delete the record.

cmdDelete.CommandText = "DELETE FROM just WHERE folder =test" & ";"
        cmdDelete.CommandType = CommandType.Text
        cmdDelete.Connection = cnnOLEDB
        cmdDelete.ExecuteNonQuery()
        MsgBox("Record deleted.")
        cmdDelete.Dispose()
        MsgBox("Enter the required values")
        cmdUpdate.Dispose()
Mr.M 89 Future Programmers

That says you need to use the

Try
' Your code here
Catch ex As Exception
' Handle the error here
End Try

or perhaps you can use the If statement and also check all the possibility errors that may occur

Mr.M 89 Future Programmers

Please post your code on what have you tried and where you are having a problem

Mr.M 89 Future Programmers

Why then don't you keep it within the program under Bin folder. The installation will put it within the program and no one can delete the program unless they really do want to or meant to. Just asking.

Mr.M 89 Future Programmers

You need to show us where are you having problem and what have you tried. Daniweb is for helping but not doing some other peoples home work. Please post what you have tried so that we can assist you.

Mr.M 89 Future Programmers

This isn't a hard thing to do, firstly you need to know how are you gonna determine the expire date then suppose on the last ten days lest you want to place the value of progress bar to Value 10 so as for each new day you minus a certain value from the progress bar value if you were working or counting with 10 from the beginning then you can then still minus 10 for each new day to 0 then as soon as the count reach 0 perform your expiration activities.

But from my understanding it won't be the value 10 if your app is a 30 days trial, you need to calculate that because the progressbar is 100 so you need to get a number that can fit with 30 then it will be much easier to minus that number for each new day.

Show us what you have done and we can help you in your problem

Mr.M 89 Future Programmers

Are updates within the exe program or are saved by an exe program somewhere?

Mr.M 89 Future Programmers

Because when you first click the item in listView it will work but when you try to click another item it will throw an exception that Argument out of range exception wasn't handled so to get ride of this just put Try and ignore this exception it will work perfect. Try it out.

This is to enable you to make selections without there closing application to be able to make another selection. This is for showing the OP what he wanted to obtain as the result so professionally he will have to handle that exception according to his guide or plan but I only ignored it to get results straight away.

I didn't know of any way to deal with it so I choose to ignoring it because it doesn't affect the system and or required results.

Mr.M 89 Future Programmers

No you must double click the ListView it self then past it there it must be in

 Private Sub ListView1_SelectedIndexChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
 ' Past the code here
 End Sub

You need to double click the ListView to get the event change handler because you are dealing with the changing of events as you are checking which item is selected.

Mr.M 89 Future Programmers

Also check this solution here.

 visualbasic.ittoolbox.com/groups/technical-functional/vb-dotnet-l/insert-data-into-an-sql-express-db-from-vbnet-form-5240174
Mr.M 89 Future Programmers

Ok. I've done this code for you.

 Try
 If ListView1.SelectedItems(0).SubItems(0).Text = "Advance" Then
 t1.Enabled = True
 t2.Enabled = False
 t3.Enabled = False
 t4.Enabled = False
 Else
 If ListView1.SelectedItems(0).SubItems(0).Text = "Access" Then
 t1.Enabled = False
 t2.Enabled = True
 t3.Enabled = False
 t4.Enabled = False
 Else
 If ListView1.SelectedItems(0).SubItems(0).Text = "EN/DN" Then
 t1.Enabled = False
 t2.Enabled = False
 t3.Enabled = True
 t4.Enabled = False
 Else
 If ListView1.SelectedItems(0).SubItems(0).Text = "Drive" Then
 t1.Enabled = False
 t2.Enabled = False
 t3.Enabled = False
 t4.Enabled = True
 End If
 End If
 End If
 End If
 Catch ex As Exception
 ' Just ignore this exception
 End Try

Hope this will answer your question.

Mr.M 89 Future Programmers

I agree with @Sanu

Mr.M 89 Future Programmers

What is the current problem? Where are you having a problem?

Mr.M 89 Future Programmers

Post your code and let us see how far you have gone.

Mr.M 89 Future Programmers

And how do I ensure that the all the data is saved that will be sent by clients simultaneously to database?

Mr.M 89 Future Programmers

So you suggesting that I must change to use db?

Mr.M 89 Future Programmers

The problem that forced me to use text files was that the free database has some limitations so that is why I thought of using text files.

Mr.M 89 Future Programmers

About the number per second it is hard to tell because yes all files have a 99.9% chances of being updated simultaneously and 1% is for those roughly out of 600 files maybe 250 yes maybe updated simultaneously but at a low speed compared to rest of the files which per second each file can be accessed simultaneously at a maximum speed.

What I'm trying to do is, suppose there are let say Musical Awards and let's say there are 1000 nominees that means 1000 files on the server and now the community is given a change to choose their favorite artist through out the province so I'm sure you can imagine the volume of writing to each file it can be so obvious I need a multi-thread so that every client will be connected and the data they sent is saved to correct files.

Mr.M 89 Future Programmers

Are you sure of the location that it correct? And also if you say if calling it secondly you mean you have a code for it in Form load and also some where else?

Mr.M 89 Future Programmers

I have many files and also there is a high possibility that each file can be modified or accessed my many (thousand) clients at the same time so for simplicity I said let's just use 1 file because if I managed to solve the problem for each file I think it will be easy to perhaps put the solution code on a call where a thread is writing to a file, keep in mind that the server is also a multi-thread where each connected client will be served by it own thread so the server also have many files too but upon splitting the client message the server be able to know which file to write the data to.

So what I'm is a problem now is that I need to make sure that for each file no matter how many clients try to modify each file at the same time the data is saved I thought it would be easy to understand if we just use one file as an example on how can one(each) file be written by a thousand clients at the same time and the data be saved for each and every client that has written the data or sent the message all the messages be saved.

Mr.M 89 Future Programmers

So this will also affect the performance of the system as it seems as if there will be lot of delays because the truth is that the system will surely have a thousand clients accessing the same file at the sametime so this seems as if there will be lot of block in the synch. Aren't there a risk of data loss while waiting if there are a thousand clients trying to write to one file at the same time?

Mr.M 89 Future Programmers

You mean with many files accessed simultaneously I should use synch block?

Mr.M 89 Future Programmers

Post your code and let us see how far you've gone and where you are having problem.

Mr.M 89 Future Programmers

Before you attempt to save data you need to firstly check if it do exist or not, checking of data existence is up to you, mean you can check by I'd, Name, etc, check out this solution here.

 itknowledgeexchange.techtarget.com/itanswers/code-to-serch-record-already-exist-or-not/

Hope it answer your question.