473,385 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Is this possible?

I have a program i made, compiled as an .exe; though each user needs to enter their IP the first time it's opened to have it store their IP.

Then i need it to be possible for them to change it when their IP changes.

How can i do this without changing the code in every project and compiling it separately?
Sep 14 '07 #1
2 756
I have a program i made, compiled as an .exe; though each user needs to enter their IP the first time it's opened to have it store their IP.

Then i need it to be possible for them to change it when their IP changes.

How can i do this without changing the code in every project and compiling it separately?
how can you persist such settings?
or, how can you detect when IP changes?

for persistence (storing the value), you can use the registry:

Expand|Select|Wrap|Line Numbers
  1.    SaveSetting "myapplicationname", "mysettings", "myip", "127.0.0.1"
  2.    GetSetting "myapplicationname", "mysettings", "myip", ""
  3.  
for checking ip, you'll need something like a winsock control.
make a reference to it in your project (it will be part of components).
then, drop an instance of it on your form.
to get the local ip, simple:

Expand|Select|Wrap|Line Numbers
  1. msgbox winsock1.localip 
  2.  
Sep 14 '07 #2
kadghar
1,295 Expert 1GB
I have a program i made, compiled as an .exe; though each user needs to enter their IP the first time it's opened to have it store their IP.

Then i need it to be possible for them to change it when their IP changes.

How can i do this without changing the code in every project and compiling it separately?
I dont think i understood you quite well, but you have two options, in the code, instead of writing the IP use a String variable, then just put an inputbox where they write their IP each time they start the program. If each user want to save a defoult IP, save it into another archive, the easiest way will be a TXT file.

Something like this will read the file and save its first line into the string called defoultIP or do nothing if the file doesnt exist

Expand|Select|Wrap|Line Numbers
  1. Dim defoultIP as string
  2. Dim myIP as string
  3. on error resume next
  4. open "c:\myIPs.txt" for input as #1
  5. input #1, defoultip
  6. close #1
now here we'll ask for an IP adress showing the defoult as the one we've already read. In case we use a different one, it'll be saved as de defoult one.
If there wasnt a defoult one, it'll show the empty string.

Expand|Select|Wrap|Line Numbers
  1. myip = inputbox("Please write your IP adress", "IP adress", defoultip)
  2. if myip <> defoultip then
  3.     open "c:\myIPs.txt" for output As #1
  4.     print #1, myip
  5.     close #1
  6. end if
and now you have the ip stored in myIP

HTH
Sep 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Julia Briggs | last post by:
I am struggling to create a PHP function that would take a specified image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail so it will always fit in a 200x250 space. I am hoping...
36
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
7
by: Andrzej | last post by:
Is it possible to call a function which name is given by a string? Let assume that I created a program which call some functions for example void f1(void), void f2(void), void f3(void). ...
2
by: Bhupesh Naik | last post by:
This is a query regarding my problem to make a spell and grammar check possible in text area of a web page. We have aspx pages which are used to construct letters. The browser based screens...
1
by: AAA | last post by:
hi, I'll explain fastly the program that i'm doing.. the computer asks me to enter the cardinal of a set X ( called "dimX" type integer)where X is a table of one dimension and then to fill it...
25
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
4
by: RSH | last post by:
Okay my math skills aren't waht they used to be... With that being said what Im trying to do is create a matrix that given x number of columns, and y number of possible values i want to generate...
7
by: Robert S. | last post by:
Searching some time now for documents on this but still did not find anything about it: Is it possible to replace the entry screen of MS Office Access 2007 - that one presenting that default...
14
by: bjorklund.emil | last post by:
Hello pythonistas. I'm a newbie to pretty much both programming and Python. I have a task that involves writing a test script for every possible combination of preference settings for a software...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.