
I have been putting back a task for ages. Basically my mapping system interfaces to the OziExplorer software, and adds text to the text that would normally appear as a ‘tool tip’. Now, each client it seems wants different information in this field. Some want nothing, and others want tons of information.
Hard coding this data is easy for me as a programmer, but is a real pain if we need to change the information that is displayed. This afternoon I finally worked out how to make this a user configurable option. Basically I place a line like the following ine into the config file.
ID:[VehicleID][CR]Company:[CompanyName] [CR] [TimeLog] [Driver][CR] Spd: [Speed] Hdg: [Heading][CR]
This converts anything in the square brackets into the variable with that name. A while back I worked out how to use the system.reflection class in VB.NET to extract the paramater names and values for a structure. What I ended up doing was something like:
line.replace (“[VehicleID]”, “1234”)
This mostly worked. The one thing I forgot was that the .replace is a function and returns the changed string rather than changing it internally. So I actually did something like:
line = line.replace (“[VehicleID]”, “1234”)
This ended up giving a result like