For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Hi everyone, my name is Maurizio and my question is this
In VB I would like to know how to create one or more objects of the same type at run time.
1) In a form I insert a textbox1 and a button
The purpose of my request is to know how: By pressing this button
It should bring up another textbox and so on.
that's all !!!!
If I remember correctly I used the New function
But it seems that this does not work in vb.
Could you please help me Thanks
Greetings from Maurizio
You can do it like suggested by Dave - the other way could be (perhaps easier to code and to maintain for you) :
- Create the Textbox you want to bring up from the beginning with the Designer.
- Set it's Visible-State to False
- When pressing the Button set it's Visible-State to True.
In this case you are able to make all the relevant connections.
You don't need to modify the Controls-Collection from the Form, catch the Events from the new Control and so on ...
Thank you to everyone for your interest
But it wasn't the answer I would have expected from experienced people like you.
/p.s) But if instead of cloning I asked for a sort of (Textbox) Dynamic with at least 5 possibility of creating (Textbox) on request!
What would have changed?
I'll explain :
If I press the key inserted in the form and I create the first dynamic (Textbox)
How can I go about creating a new one at least five times the same size as the first?
I tried to write something like this; But it is valid only for the first dynamic (Textbox)
Therefore I would miss being able to create all the others every time I press the create button.
They all "default" to the same size and location unless you "change" the property's default value at "construction" time or subsequently. Based on your problem description, that's all that "experience" dictates. If your requirements are more complex, you have failed to articulate them; perhaps it needs "reflection"; but that requires "experience".
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
I have created a program that is intended to be used by multiple users (each on their own computer) who access the same SQL database. I have also created a separate updater program to sit alongside the main application. However, I am unsure how to check if there are any users in the main program before the update is run. (This is easy to do on a single user application but not sure on multi-user).
Sorry, but you wrote that every client application is opened on client machine. You don't have to care about other clients.
So, if a single instance of client application is running on client machine, you can close it via updater.
I think what you need to research is the topic of concurrency.
One way to implement this is to have a Modify Date on the primary record.
1) Read the table entry along with the modify date/time.
2) When updating the database, compare the original date/time with the value currently stored, if the date/time has not been changed, then it is OK to perform your update. (Rollback)
During your update you would set the modify date/time to the current date/time. (GetDate() )
I am sure this is not the best format to ask this question/ have this general discussion.
My project is at the barebones, working on a lot of the basics at the moment. The plan is to have a game completely ran on a userform.
Really the only thing I have kind of figured out is the the key logging to track when the space bar, left, right, up, down arrow keys have been pressed. I have only figured out how to do that if a textbox is the focus. Not the happiest with that at moment. Any thoughts on this is appreciated.
I have done a ton of research to see what is currently out there. A majority of the code I find is ran on a spreadsheet, which becomes the base/map. Taking away the spreadsheet leaves my google searches with not many results.
Something I have thought of is having a userform with multiple textboxes like a spreadsheet. Each textbox would be like one cell on a spreadsheet. Problem with this is that I don't think that would do well once trying too get more advance with the game.
The thing that seems like it will be key is keeping track of the pixels location of every object and creating the game logic from there.
The object of the game really isn't the focus right now. To give an end game for my first problem/"curiousosity on how others would go about it" lets say the game is to have a character dodge incoming missles/objects that would come from any direction straight across the board.
I would post my code but it really isn't much at the moment.
1. Please don't respond with something like "why would you do this in vba" or anything like that. I am well aware that there other languages that would better fit this.
2. Sorry for everything being "scatter brained" this is my first time posting a question after about 2 years of doing multiple projects using vba.
3. If there is a better site or resource to use for what I am trying to do please let me know.
There isn't any direct questions, more so looking to get thoughts and opinons on anything I put out there. Appreciate any feedback!
In other VB Windows Forms implementations, the KeyDown/KeyUp events on your Form will only work if the Form has the focus. If the Excel sheet has the focus, they will not work.
Also, in order to get those events to work when any control on the Form has the focus, the KeyPreview property on the Form must also be set to true, though, it appears that this doesn't even exist in Excel VBA.
Basically, without a working KeyPreview property, you cannot do what you appear to want to do.
Good evening everyone.
I'm trying to implement a user control's drag & drop and would like all control to follow mouse movements. However the method does not allow me to move the entire control, but displays the mouse arrow with the classic drag & drop icon.
How can I solve this problem in Vb.net