|
Before I go crazy on this I was wondering if somebody could point me in the right direction
I was trying to use a structure to store "datasets"
Anyway: Creating / populating the structure seems straight forward
Public Structure Test_Structure
Public Name As String
Public MapTo As String
Public Description As String
'......
'....
End Structure
Dim TEST(10) as Test_Structure
Test(0).Name = "FirstName"
Test(1).Name= "SecondName
But How do I now search / get the index for the Dataset containing the .name "FirstName"
Should I use a Hashtable to store the index ????
Thanks
georg
|
|
|
|
|
You would use foreach to iterate over your array and check each item for the value you want.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Well if that's the "only" way, a Hashtable will be a lot faster
I just can not belive there is not another way of indexing a Structure .
One would think that indexing / searching is probabaly one of the most required tasks to be performe with a structure - But I might be wrong
Georg
|
|
|
|
|
Well a structure doesn't automatically build indexes into all it's data, imagine how wasteful that would be if it did that even when not required. Yes, a hashtable would be faster.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
First of all, you should not use a structure for this, you should use a class. A structure should not be larger than 16 bytes, and you break this if you have more than four string references. Also structures are tricker than classes to implement correctly.
If you want a fast lookup for a field you can create a Dictionary with the field as key and the object as value.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have written code that captures the image of windows. It works fine but when I try to capture "Program Manager" (the desktop), it captures ok, but the whole screen goes black and using alt tab to redraw some of the screen and then taskman to quit my program is the only way to get it all fixed. Why does this happen when tryng to capture Program Manager?
|
|
|
|
|
|
No. The actual window of the desktop is named Program Manager. For some reason snapshotting it specifically causes the problem above.
Screenshot:
(thats what it looks like once I try to snapshot program manager. The snapshot it takes does look like the desktop correctly though.
http://i258.photobucket.com/albums/hh243/omnicoder/err.jpg[^]
|
|
|
|
|
Hi, I am looking for help on an app that alows me to select fields from access to populate a form (could be multipage form) with subset of recordes and export the form into word or start with a word doc it does not matter
please contact me asap, I am willing topay for help.
Thank You,
Simon sybaco@gmail.com
simon
|
|
|
|
|
Sorry, unless you have a specific question about code YOU are writing, you've come to the wrong place. You may want to try RentACoder.com.
|
|
|
|
|
|
I need an image to match an exact size however the image that must match the size is always different. How can I add blank transparent space around an image to increase the size?
For example say I have 3 images. 520x200, 340x400 and 700x500 and they must all be 1280x768. How can I add blank space around the 3 images so they will all be 1280x768?
|
|
|
|
|
There are two possibilities. The first is that you don't need to add anything to the image. Depending on your requirements, you just do the math to center the image properly and draw it yourself. The second is that you create a bitmap object of the size required and, again, do the math to center the image and draw the image onto the new bitmap.
|
|
|
|
|
Thanks creating a blank stretchec bitmap from a blank transparent png and drawing on it worked. Thanks for the help!
|
|
|
|
|
Omnicoder wrote: creating a blank stretchec bitmap from a blank transparent png
Why would you do that? Just create a new empty bitmap...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have a data input form (Name, address, phone, etc) (Form2) that is launched from the main page (Form1). I want to use the same form for both add and edit functions - is there a way i can do something like this:
["Add New User" button pressed on Form1]
Form2.Show()
(Form2 Loads...)
If.....then...
btnAddNewUser.Visible = True
btnEditUser.Visible = False
basically, for Form2 to "know" what button was pressed on Form1, and change the buttons that are visible on Form2 based on Form1 input. Global variables? Or is there a function that will automatically do this?
Thanks!
|
|
|
|
|
sarmedic wrote: basically, for Form2 to "know" what button was pressed on For
You have several options
sarmedic wrote: Global variables?
This will work, but is nasty as hell
sarmedic wrote: Or is there a function that will automatically do this?
No
The most obvious way to do this, is to pass a flag in to the constructor for your form, or if the same form is used over and over, then make it a property on the form. Why do you call Show and not Show Dialog ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am new to VB express 2008 express edition. I am working through some materials and am trying to design the form and write the coding to the following problem and am struggling greatly. Can anyone do it and I will work back from it and see where I am going wrong. I have one day to complete it.
A manager of a canteen want to write a program to calculate how much each customer has to pay. Memebers of staff are to pay VAT on their purchases but pupils do not. If the customer is a member of staff then the program will calaculate the VAT and add it to their total cost.
VAT is calculated using the formula.
VAT=0.175 * total cost
Their are 3 inputs in the program.
1 how many items the customer wants to buy,2
2 the price of each item and
3 whether the customer is a pupil or a member of staff (P for pupils and S for staff)
Output must display the total cost of the purchases, the type os customer, the amount of VAT paid and the final cost.
I would be really grateful if you could help me.
Thank you
|
|
|
|
|
Oh dear, this really isn't a good first post for the Code Project forums. You shouldn't ask us to do your homework and you probably should have started it before now.
Can anyone do it and I will work back from it and see where I am going wrong.
It would be better if you let us see what you've done, if in fact you have done anything, and then we'll take it from there. Try to post specific questions with short code snippets that illustrate any problem you may be having.
Alan.
|
|
|
|
|
This is incredibly easy. You should talk to your teacher if you're unable to understand how to do this. Someone doing this for you, is only going to mask your inability to do it, and further retard your progress in your class.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all...
I am developing an application completely in MS_ACCESS. I have my project and the Access database at different locations e.g C:\ & D:\ resp.
Now i want to fill the combobox with two fields Srno, Name.
Help me how would I do it..
Thanks & Regards..
|
|
|
|
|
If you are really just using MS_ACCESS, this question might get more response if you posted it in the 'General Database' forum.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
|
|
|
|
|
Hi,
I would like to write a vb.net program that will programmatically position the mouse anywhere on the screen (not just the programs form) and then control the buttons and wheel. I.e. click on other applications.
Is this possible and can some please point me in the right direction.
Thanks,
Steve
|
|
|
|
|
Well, this isn't as easy as it would sound, but it is possible. The biggest problem is that control positions change along with the position of the windows you're clicking in. Also, directly controlling the mouse and simulating a click is not the way to go. You have to send the appropriate window messages to the control you're "clicking" on, without doing anything with the mouse. You have to get the handles of control windows (every control is a seperate window) to send these messages to. This means knowing the controls class type and name and how to find the correct control you want to click on.
You'd have to do research on FindWindow, SendMessage, various window messages, Windows Hooks, the CBT hook, message pumps, ...
Seriously, this is NOT a beginner level project. If you don't know this stuff, you're going to find it extremely difficult to do.
|
|
|
|
|
Thanks for you reply.
Whilst I am a beginer in this topic I have actually been programming since the days of the ZX81 (~1981), all be it as a hobby and mostly self taught, I have come across the API's you mention before. Whilst it will be hard, if feel that with a little help pointing me in the right direction I ought to be able to manage it (if it's possible from within VB.net).
I do not want to acces any partucular control on any prticular form.
Rather I want to control mouse behaviour using an input device other than a mouse, if I can do it with a keyboard' I can do it with the controller I have in mind.
I have become disabled and am looking for a more effective way of interfacing with the computer than the conventional mouse and KB.
Thanks again
Steve.
|
|
|
|