VS 2010 Place Two Events Under The Same Sub?

May 20, 2012

Well I currently just finished my game, but it ended up around 1GB. Thus, I tried to revise the code to make it smaller. I am trying to get 2 form events under a single sub. For example, a sub for a town would have the shown event and the click event. However, when I try that it won't work.

The other way is to transfer variables and its data from one sub to another. But I dont know how to either Example:

Private Sub Number
Dim TheNumber as integer
TheNumber = 1

[Code].....

View 18 Replies


ADVERTISEMENT

VS 2010 The X,Y Value Place Changes?

Aug 16, 2011

I have made a X,Y counter with a timer and a Label. Its work, but sometimes the X,Y values is not corret, as before.We say that a red dot has the X,Y Value 300,400. Then i close the program och open it and check agin. Then the dot can have the X,Y values 304,407. Now it's seems to be that the program has choosen that the red dot has the 304,407 as X,Y value. But i KNOW sometimes it's goning to chanes back.

View 1 Replies

VS 2008 Navigating My Code - Flow Can Jump From Place To Place

Mar 11, 2010

Like I imagine everyone, I often have problems navigating my code because the flow can jump from place to place. For example, if my code calls routine1, and I then want to go to routine1's code, I know that I can click in the dropdown menu and it will take me to that sub. But wouldn't it be easier if I could somehow right click on the call to routine way and select something like 'take me there' which would transport me from the function making the call to the code for the function being called? Then it would be easy to hop from place to place.

View 1 Replies

VS 2010 : Getting Place Value In Combo Box?

Dec 8, 2010

I have a loaded combo box and was wondering if there was a way i could get the place value from it when it is selected. An example would be i have a combo box full of foods:

Apple
Bannana
Peach
Pear

if the user selects apple then i want to be able to get 1 from the combo box since that is the spot it is in. if peach was selected then i want to get the place value of 3.

View 2 Replies

VS 2010 How To Place Stuff On Forms

Aug 19, 2010

how to place stuff on forms and such but not much else so i was wondering if a book was better to use to learn or something from a website? if book which books should i check out or which website?

View 5 Replies

VS 2010 RichTextBox : Char Always On The Same Place

Aug 17, 2011

I made my irc client. It sends & receives to a richtextbox like this :

Well, you might know mirc or nns, there it is like this :

How can I do it the same, so all the text is at the same place, under eachother, like on the second screenshot.

& another question : How do I color words in a richtextbox ? I tried Selectionstart = Find("blablabla")& selectioncolor = color.red

but that selection dissapears when someone send a new comment.

View 1 Replies

Copy Folder With Its Content From Place To Another Place?

Dec 18, 2011

How copy folder with its content from place to another place. example from C: to D:

View 15 Replies

Can't Place A Textbox Upon A Groupbox With 2010 At Runtime

Feb 2, 2011

I'm able to place a collection of textboxs on a form at runtime (no surprise)[code]...

View 3 Replies

Place To Learn Web Site Development Using VB 2010?

Sep 22, 2011

I always wanted to make some websites. Is VB 2010 a good tool to make websites?

Where is a good place to start. Tutorials, examples and all of that.

View 1 Replies

VS 2010 - Calling API From Resource Or External Place

Jan 15, 2011

In a program of mine, I have a resource (which is a textfile). This contains also vb.net code, It is resource which is binded to an .exe, with the mainprogram that I have. So the main program calls the resource, and the resource bind to an exe file.

I have this line:
Declare Function GetProcAddress Lib "kernel32" (ByVal handle As IntPtr, ByVal name As String) As IntPtr
In the source.txt and I want to replace this whole line by a string(or word) which calls this line from somewhere else. For example in another source.txt. A textbox is not possible because this is not a vb form, but a .txt-file. Maybe I can create another resource, which IS a vb.net form, call it or something? In this case. I can create a textbox with this line that I gave above, And I can use it by: textbox1.text.

View 2 Replies

VS 2010 - Randomize Text From List And Place Into Another Textbox

Jan 23, 2011

I am creating a Map Rotation Randomizer for my Call of Duty clan, and I am having an issue with understanding how to randomize the text from the list and placing it into another textbox.

Here's what it looks like right now:
All textboxes are multi-line.

When I click a button for a game (CoD4, MW2, WaW), it places the map list into the left textbox like:
mp_bloc
mp_broadcast
mp_crossfire
etc.

When I click the button with ">>>", I want it to randomize that list and place it into the right textbox like:
map mp_bloc map mp_broadcast map mp_crossfire

Or if I click it again:
map mp_crossfire map mp_bloc map mp_broadcast
And so on. I think I need to create an array, but I've never worked with those before as I'm still new to learning programming. I'm not even sure what controls I need to put on the form for that, if it even requires any.

View 13 Replies

VS 2010 Place 2 Hire Coder/tutor To Project?

Apr 26, 2012

I'm in college & in my part time I have been working on some automated web task apps. Just real basic stuff to automate my own personal account tasks on small social networks (not facebook!) to keep up with fan's for my 'soon to be' record label....nothing multiple accounts & it's not any kind of unsolicited spam functions. I know I could obtain most/if not all the info/code I need on this forum... I guess some people just need their hand held more than others, in order to stay focused.

Basically I've just got some things I'd like to add to my application that are above my ability & I need someone to help me out with my code. REALLY SIMPLE STUFF..like I've still yet to figure out for example:

1) How to simply pause between functions, as opposed to having to use a timer for each function. And using 1 timer to enable another timer...and so on in that fashion. Which becomes incredibly confusing & hard to edit after adding more than 3-4 timers reliant on each other LoL

2) Figuring out a way to not have to rely on 'webpage has finished loading' to move onto the next task. When many times on social networks, pages don't load properly, especially during peak hours, thus stopping the function of my web browser based application.

3) Implementing my application using a superior web browser framework. For example Gecko, or some other 3rd party browser that can perform simple tasks like filling forms, submitting them, clicking links/clicking javascript links.Right now using I.E. web browser, after my application has loaded about 75 web pages, it's using about 200mb of ram (from its initial 16mb) because of a memory leak in I.E. to which there is no solution (documented in several threads on this forum).Where in your opinion, would be a good place to look to hire a programmer/tutor for something like this? Because I am not looking for just code, but hands on, like on IM messenger/talk me through help too. I wonder if there is even a place offering services like that?

View 1 Replies

VS 2010 - Subtracting - Subtract From Textbox1 And Place The Output In Textbox2

Dec 10, 2011

Textbox1 will have the number 0x08800000, It may also be more than one line, so for example;

0x08800000 0x02313823
0x08800000 0xDEADBEEF
0x08800000 0xBEEFBEEF
etc etc

I only need to subtract 08800000 from whats in bold, the rest will stay the same. The value in textbox1 will always begin with 0x0880xxxx I need to convert that to 0x00000000 so basically I need to subtract 08800000 from textbox1 and place the output in textbox2.

View 10 Replies

VS 2010 : Search String In Tabbed Textbox And Place It In A Label?

Jan 7, 2011

I'm creating a new (or more) tab(s) with a multi-line textbox (filled) at runtime and some text is added. Each time I change/select a (new) tab it needs to search for a string and if found...blablabla.How do I get the control to search in?

View 8 Replies

VS 2010 Datagridview Colum : Getting A Total Of All Numbers, Place Into A TextBox?

Nov 14, 2011

i have a DatagridView, with a Colum " KG".Into the Colum, i place numbers.Now i wants a total of all numbers, place into a TextBox, using a code.

View 15 Replies

VS 2010 Place Drawing Logic On Form Or Within Object To Be Drawn?

Sep 10, 2010

I am working on a snake game for my portfolio and was wondering where the best place to put the logic for drawing the snake. Should the code reside within the snake object or within the form? Either would work, but I am wondering from a business objects/coding standard perspective where such code belongs.

View 2 Replies

Cant Move My Form From Place To Place ?

Jun 21, 2011

My form cant move i set none to formborderstyle and made my form transparent using

CODE:

So now i cant move my form from place to place.

View 4 Replies

Place All The Objects In The Same Place On The Screen

Nov 30, 2011

I am learning Visual Basic 2010 and I am working on a space combat program for my own education and amusement (a simulation of the Honorverse space combat system). I have a routine to add ships to the enemy ship roster and then place them randomly on the viewscreen. When I step through the sub with the debugger, it works fine, but when I run it without stopping, it wants to place all the objects in the same place on the screen. It's actually assigning 2 random numbers pertaining to the size of the viewscreen and assigning those numbers to GameObjectScreenLocation through GameObjectWorldLocation.X and GameObjectWorldLocation.Y. The objects are fully initialized to 0 in their constructor, FYI. Code is below:

[Code]....

View 3 Replies

VS 2010 Events And User Controls?

Feb 27, 2012

I made a custom control for my form. It's basically a custom button I made using a label.The only problem is, when I apply a myButton_Click event to the control in my main form, it will only be triggered if the control itself is clicked. The label takes up the entire form (it's docked inside it). The click event isn't triggered when the control (virtually the label) is clicked. You must click behind the label (the form's background) for the event to be triggered. How can I pass the myButton_Click event to the label so it is triggered when the label is clicked? I hope I'm making sense.

View 9 Replies

VS 2010 Handling Multiple Events At Once?

Nov 23, 2011

I took a VB class a couple semesters ago and I did really well. Unfortunately, it seems as though we only covered the very basics within the class, as I feel rather clueless right now.

Here's my issue. I'm trying to write a program that will encode notes (like music notes, A-G#) which are entered by the user, into digits, 0-9. Now I have the system laid out, in that 1-8 will represent A-A, while a 0 or 9 preceding a digit will represent a flat or sharp respectively.

Now my question is actually rather basic, but I just can't seem to figure out how to do this. The user will enter the note sequence by clicking on buttons (12 of them). What I'd like to do is create one sub that will handle all possible button clicks. I suppose it's possible that I could have separate subs for each and every button; but it just seems more efficient and cleaner to have one sub that manages them all.

The part I have completed and working properly will display a message (the same message) in a messagebox each time any of the buttons are clicked. So I have the "Handles" part working for all 12 buttons. But what I'd like to do is write code, perhaps "If" statements such that If "btnA" is clicked, then say "You clicked Button A," and If "btnASharp" is clicked, then "You clicked Button A Sharp," and so on. Is it possible to do this somehow by recognizing which event was actually triggered?

View 2 Replies

VS 2010 Handling The Parent's Events?

Jan 28, 2012

I am trying to make a UserControl or Component which can be dragged from the Toolbox onto a container control such as a Form or a Panel. Its purpose is to change the behaviour of that container. In particular, I would like to add functions to the container's painting and mouse actions. I DO NOT want to have to write code for the container itself -- that's the whole point of the Toolbox object.

I can do this by getting a reference to the object's Parent (or Host in the case of a Component) and handling its events, as this example illustrates:

[Code]...

However, I have heard that handling the events of a parent control conflicts with OOP principles. So I would like to know, does that objection apply in a case like my example? If so, what are the drawbacks? And what alternative techniques are available?

View 2 Replies

VS 2010 Missing Mouse Events?

Jun 5, 2011

I'm working on a grid of cells that is something like a DataGridView, but not really. The two are close enough that you can picture a DGV for the purpose of this question. What is actually there (and this is true for actual DGVs) is a set of cells drawn on the screen with a couple scrollbars for vertical and horizontal scrolling which are only drawn if there is too much data to show in the visible cells. There aren't more cells than the ones that are visible, so when you scroll the scroll bar, it looks like new cells are being displayed, but what is actually happening is that the existing cells are just being filled with different data depending on the position of the scrollbar. The key observation is that the set of controls displayed in the grid is always the same (unless the grid is re-sized, but that's not relevant to this issue). The appearance of those controls can change, but the controls themselves do not.

One of the features I am adding is the ability to drag-copy data similar to how Excel works. In my case, if you click on a cell, then drag outward (move the mouse while holding the button down), all the cells in the selection rectangle are tinted green. This works nicely. Some of the cells are enabled, while others are disabled. If the drag selection includes disabled cells, those are not tinted. Only enabled cells can be selected, though a drag can cover disabled cells. The relevant point here is that some cells are enabled and some are disabled.

The feature that I am adding is the ability to do drag selection beyond the visible edge of the grid. The grid is a monthly calendar, and I simply can't get 31 cells onto even a wide-format screen. What I am trying to do is allow the user to do drag-copy onto days that are not currently visible. The way I do this, the user clicks in a cell, then drags out to the border, at which point the grid scrolls (the scrollbars move, and the contents of the cells is updated as a result of the changes to the scrollbar value). This is largely working.

The way I handle the selection is that when the user presses the mouse button while over a cell, a flag is set to indicate that the button was pressed, and the current cell is recorded (so that I know where I started from). MouseMove events are used to figure out what new cells the user has visited, and set the selection area based on whatever is under the rectangle described by the initial click point and the current point. Lastly, when the user releases the mouse button, the MouseUp event initiates the actual copy. At that event, I know that the user is done with that copy action. Therefore, the MouseUp event is kind of critical, and therein lies the problem.

As I mentioned, some of the cells are disabled and some are enabled. Disabled controls don't raise events. If I click on a cell, it HAS to be enabled, but that's fine. The problem is that if I then move the mouse in such a fashion that the grid scrolls such that the cell that I had initially clicked on is no longer enabled, then the cell doesn't raise events any more, and the MouseMove and MouseUp events stop happening.I only see one viable solution, which is to not toggle the enabled state of the grid cells. Instead, I would have to have to add a custom property that would make the control act and look disabled as far as the user was concerned, but it wouldn't be disabled as far as the program was concerned such that it would keep raising mouse events. This would be pretty rough, since I would need to prevent the control from appearing to have focus even though it technically would have focus

View 11 Replies

VS 2010 Mouse Events To Another Window?

Feb 27, 2012

How can I use mouse events to move and click my mouse in another window.

For instance, I would like to move the mouse to 62,88 of "Untitled - Notepad".

so far I have:

Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As IntPtr

[Code]......

View 2 Replies

VS 2010 Mouse In Motion Events?

May 31, 2011

I'm trying to make a way to navigate around a custom grid. Basically, I'm implementing the drag-copy feature from Excel. Right now, you click on a cell grid and can drag around the grid. Anything in the drag area gets a green tint. Once you release the mouse button, whatever was in the first cell selected is copied to all the others that are tinted. That works pretty nicely, but it works only for the cells visible on the screen. I can live with that, but decided that if you dragged over the scroll bars or the column or row headers,then the grid should scroll (if there is anywhere to scroll).

That's where the problem arose. It turns out that scrollbars don't raise the MouseMove event (at least not as far as I can see), and the MouseEnter and MouseHover events are not fired as long as the mouse button is held. Interestingly, the MouseLeave event does occur when the mouse button is held, just as the MouseMove event is occuring for all the cells. That's pretty annoying. Why do some mouse events get raised when the mouse button is down while the others don't? Also, I suppose, is there any way around this?

View 2 Replies

VS 2010 Picturebox Paint Events?

Mar 27, 2011

I am working with a picturebox and i am drawing lines during my paint event. My goal is too draw the lines and export the picturebox.image with the lines i drew out to a Everything seems to be working correctly so far. The code executes. A file is written. But it is always just the original image from the picturebox with no lines on it. I have setup the pictureboxes so i can see exactly where i am in the code when it trys to save. I can also verify that before i click the button that calls the save feature the lines are absolutely drawn in the picturebox.

I seem to remember someone telling me at some point that the lines i draw wih the paint event are not actually a part of the picturebox image but more an overlay on top of it. I think this may be my issue. Hopefully someone can shed some light on this.

[Code]...

View 6 Replies

VS 2010 Usercontrol Focus And Key Events?

Jan 15, 2012

A form's key events will fire when you press a key. Place a control on that form and it won't happen any more because that control has focus. There are exceptions to this however as you will see if you place just a h or v scrollbar on the form. The key event will fire because the scrollbars can't receive focus as is demonstrated by the following

Private Sub ScrollBar1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles VScrollBar1.GotFocus
Debug.Print("Scroll GF")
End Sub

[code]....

So I've made my own special scrollbar usercontrol and i can't figure out how to have it leave the key events alone. I'm pretty sure that the problem is that my usercontrol can receive focus at the moment.

I found that the way of doing this is "SetStyle(Windows.Forms.ControlStyles.Selectable, False)". I put that in the new event of my usercontrol and now it looks like this:

Public Sub New()
' This call is required by the designer.
InitializeComponent()

View 4 Replies

VS 2010 : Events Validating And Validated Not Firing?

Apr 11, 2011

I'm trying to use the events Validating and Validated on a ToolStripTextbox.

Private Sub txtMenuOwnIP_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtMenuOwnIP.Validated
MyIP = txtMenuOwnIP.Text
StatusLabelIP.Text = MyIP
End Sub

[code].....

Neither code is firing.The CausesValidatition of the txtMenuOwnIP is set to true.I can enter stuff into that Textbox and leave it using the Mouse or simply piush Enter, but the posted code won't get fired (used a Breakpoint in both subs). There are no other event routines for this command used.

View 5 Replies

VS 2010 Administrator Priviliges On Specific Events?

Apr 19, 2011

I know I can set the program to require administrator privileges in the manifest file.However, I don't need the whole program to have these privileges.

I only need admin when I want to write to the registry (this doesn't happen often).9 out of 10 times when the program runs it doesn't need to write to the registry, so only when I click on a specific button the box where the user can choose wether or not to grant admin to the program should show.

View 1 Replies

VS 2010 Form Unable To Handle Other Events?

Apr 7, 2011

I'm trying to use a asynchronous UDP-Port to recieve data on a form.I manage to receive one message at a time(for each click of btnReadData), however if I do this receive in a loop (in order to continously receive new messages), my form seems to be locked.What am I doing wrong?

Public Class FPR2DIS
Delegate Sub dDataReceived(ByVal Data As String)
Dim UDPWorker As New Worker

[code].....

View 3 Replies

VS 2010 Scheduling Time Sensitive Events?

May 5, 2010

I have a question for the well versed among you. I have done some research, but didn't seem to find the exact answer I was looking for. So without further adieu.Given an event which needs to occur at a very specific time, whats the best and most predictable way or making that happen.

A: Use a worker thread, and threading.thread.sleep(TIME).

or B: Use System.Timers.Timer or System.Threading.Timer to execute in (TIME).

NOTE- I am fully aware that any of these will work. My question is in regards to priority of execution. How will a timer, which I can't figure out how to set a priority on, compare to a thread with a priority of Highest or even Real Time. Microseconds DO count in this instance.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved