Here are the techniques I've used successfully for connecting from my Windows computer to my Raspberry Pi 3 running Raspbian. I experimented with a few techniques because at first I didn't have a WiFi modem, and the modem I did have had only one Ethernet port. After that I got a WiFi modem.
The three possibilities are the following ones and the steps for doing each one is detailed below.
However, the Raspberry Pi seemed to be losing the connection after only a minute or so. It turned out that it was configured with power management turned on and something to do with this was causing the problem, though I don't know what specificially. I searched quite a bit for a solution and tried a few things and turning off the power management feature was the best I could come up with. Since I use the Raspberry Pi as an embedded computer that's supposed to be always on, this was a resonable solution for me.
1. On the Raspberry Pi, go to /etc/network. Since I was doing this from a command line terminal, I did:
2. Edit the file that you'll find there called interfaces. To do that I first used the "ls" command to verify that it was there and then I used the editor called nano as follows:
3. In the interfaces file, add a line containing "wireless-power off". The line can go anywhere. Notice that I added a comment too so that I'll know what it is if I ever edit the file again.
4. Save the file by pressing Ctrl-O and exit the editor by pressing Ctrl-X.
5. Restart the Pi. Make sure to use the shutdown command first to give the editor and anything else time to write to the SD card.
Once the Pi was back up I verify that it worked by entering "iwconfig wlan0" from the command line. It gave a bunch of information, including a line saying that power management is off. I no longer lost the network connection.