Pressing Alt Or Tab Caused Redraw?
May 30, 2011
I'm trying to do a little remake of the old game Achtung! Die Kurve, which is a snake-like game, but with multiple players trying to corner eachother until one remains. Don't play it, it's way to addictive, thats why I'm doing the remake now, I want to play it with up to 8 players instead of 6.
Now here's the problem: to draw the snake, I just use the GDI+ and make it draw a 3x3 rectangle on the form background. It works fine, until you resize or minimize/maximize or something like that, which causes a complete repaint of the form. This is not a problem... but when I press ALT or TAB, the form repaints.
And even stranger: it only happens the first time I hit each button. I can make it happen twice by hitting ALT and then TAB or vice versa, after that, nothing. I really don't get it, and its driving me crazy. I dont want a game with a splash screen saying 'First hit alt, then tab to start the game. Not at the same time that makes you leave the game.'
View 1 Replies
ADVERTISEMENT
Oct 26, 2011
i'm using Enumerable.Except to check if a DataTable in memory is in sync with the table in database.
The background is: this DataTable and other frequently used tables are stored in the Cache of a WebApplication. But meanwhile i'm convinced that this is not a good approach because it's a source for nasty errors that are difficult to reproduce/debug.
Therefore i've created a function that checks if database and memory are in sync, otherwise an error-log will be created. This works perfectly. If there is a row in memory that is not in database, this row will be shown below "Difference in database", the same applies in reverse. But if rows exist in both datasources(the PK idRMA) and some values differ, the log will contain this row in two versions(below "Difference in database" and "Difference in database"). It is not easy to see the differences on the first sight.
Q: Is it possible to select only the properties that caused Except to think that first sequence is not in second?
This is the the complete function(the first lines are relevant):
Public Shared Sub CheckRmaMemoryInSyncWithDB()
Dim inSyncText As String
Dim color As Drawing.Color
[Code]......
View 3 Replies
Mar 3, 2009
I have an event which handles multiple controls. How can I tell which control caused the event? [code] I want to run validation on each control, (combo and textboxes) and if it succeeds, enable a button. I could do this for every control individually but I want to know if I can use the sender value to determine which control needs to be validated.
View 3 Replies
Apr 5, 2010
I have a situation where I need to ignore parts of page load sub inside a isPostback = true. Basically inside the isPostBack I want something like if button1 caused postback.... do this else do this...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack = True Then
If TextBox1.Text <> String.Empty Then[code].....
View 4 Replies
Apr 19, 2012
I have 2 button controls. When I click one i'm trying to determine which one caused a postback in the page load.How to do determine this?
View 3 Replies
Apr 1, 2011
I am writing a VB program that measures the voltage on a circuit and then graphs the voltage value. I read what the voltage is at ever milisecond and load that value into an array and shift all the data one to the right. On each timer tick i regraph the data.
The problem i am having is on each tick i erase the picturebox then i redraw the graph using the new array. Because of this the further out the line is from the start of the drawing processes the less it shows the line. You get a flicker effect. I have been seeing if there are ways to remove the flicker but the few things i have found have to deal with doublebuffered but i do not think that is the issue here. I think i need to find some other way to clear the picturebox.[code]...
View 9 Replies
May 2, 2009
I'm working on an application with multiple forms. On the first form, the user clicks a button and a simple shape is drawn in a picturebox.Depending on which shape is drawn, a value is assigned to a global variable called baseShape. I want that shape to be drawn automatically on the next form when that form is shown. I haven't been able to find any discussion on "passing graphics" from one form to another.[code]...
View 3 Replies
Jan 20, 2009
We are using a ribbon control from a 3rd party that has a bug. When you click on another app, fragments of our software still shows on the screen. The company that makes the ribbon is working on a patch, but I would like to get the app working while we are waiting. how to force windows to repaint the client area behind the form when the form is deactivated?
I've searched and been reading through posts, but most everyone wants to repaint portions of their app. I want windows to redraw what should be there when my app isn't in front anymore.
View 1 Replies
Sep 12, 2011
I am trying to develop a web application to populate data to three datagrids(datagrid control) using 2003 version, each datagrid has three columns and about 10,000 rows. The problem I got is it only allow load data once, whenever I changed the setting and reloaded data, the Page Can Not Be Displayed error will popout. I tried to remove one or two datagrids, it would allow popu
View 2 Replies
Feb 24, 2012
I opened up a project from a while ago (an app we use daily) to implement FileSystemWatcher. I thought I did my homework but apparently not.As it was, a button fired off a sub to do some work. Instead of the button firing it off I wanted a file change to fire it off. Only after implementing FileSystemWatcher, now nothing in my app works. Just about everything I try to perform is met with this error:
"Cross-thread operation not valid: Control 'TabControl' accessed from a thread other than the thread it was created on." (TabControl being from purecomponents)My best guess is, when I create the watchers I'm throwing my app into some sort of background thread? Is there a better way to start the watchers? Or do I have to now change all existing code with invokes? I get a little lost at that point.
Here's are the only changes I made to my app:
Public TabFilesToWatch As List(Of FileSystemWatcher) = New List(Of FileSystemWatcher)
Sub form load:
WatchTabs()
Private Sub WatchTabs()
For Each Tabs As TabStructure In TabsArray
[Code]...
View 4 Replies
May 18, 2010
We have some code in the textCahanged event of a textbox. We only want to fire that code if the user types into the box, not if we change the text in the box programmatically. Can I detect what caused the text to change?
View 12 Replies
Feb 17, 2012
I have the interesting task of doing some graphs using VB.NET. So far, everything that I´ve been reading about GDI+ and e.graphics whatever is really weird. All I want to do is1) Calculate some coordinates clicking button 12) Click button 2 to draw a line with the numbers from button 13) Click button 1 to get new coordinates5) click button 3 to clear the graph. So I decided to draw everthing on top of a Panel, called panel1. I have a routine that draws on screen called drawlines,
Private Sub drawlines(ByVal g As Graphics, ByVal c As Color)
Dim p As New Pen(c, 1)
g.DrawLine(p, xStart, yStart, xEnd, yEnd)
[code].....
View 1 Replies
Feb 7, 2008
Here' s my code to draw a single line on a windows form.
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawLine(myPen, 0, 0, 200, 200)
myPen.Dispose()
formGraphics.Dispose()
I would simply like to erase it now. I've read that the best way to do this is to re-draw the whole form, or to delete the line object..etc..
View 4 Replies
Jun 20, 2012
I am having and issue with a VB.NET App that displays data derived from a database in a DataGridView Control. I am retrieving the data into a dataview and then setting the Grid.Datasource = oDView. On most machines it refreshes the data cleanly and quickly as you would expect.
[Code]...
View 2 Replies
Jul 22, 2010
I am using a DrawItem and MeasureItem events to paint a combobox with a DrawMode of OwnerDrawVariable.Basically, I'm trying to have the user highlight a selection with the mouse, and then press the space bar to toggle the Save status of a song list. Then I call the Me.Refresh() event for the form in an attempt to redraw the form and the ComboBox.The problem that I am running into is that only the Combobox itself (not the drop-down area) that is a control on the main form is redrawing, and the text that is behind the mouse-highlighted selection of the drop-down list is not changing from Red to Black as I believe it should. If I move the mouse to another selection, then the color does in fact update.[code]
View 1 Replies
May 12, 2012
I have a RectangleShape on a form and certain events that invoke the Paint event for the Shape.But it redraws unwantedly when I drag the form to the taskbar or minimize and then maximize it or press the alt or tab key while the form has focus.I do not want this to happen. I have made sure that no other event fires the RectangleShape's Paint() event.
View 5 Replies
Nov 19, 2009
i want to know what are the methods in order for me to extract the information that is stored in the exception. i also would like to know how do i extract the code line that caused the exception to occur.
View 6 Replies
May 7, 2012
it is clear that an Object handling an event has to unregister himself of that event before it ends, to avoid not been cleared from the memory by the CG - especially when it lives longer than the "Event Raiser" object. But, on the other hand, I wonder if it is possible to encounter this problem on the web server... Is it possible that the server will keep this object alive, even if the execution context (i.e. the web session) has died? Are'nt all the objects related to a session cleared with the session itself?
View 1 Replies
Dec 3, 2011
I recently installed Visual Studio 2010 which caused the same error, every time i try to start the program i get this message. i am using windows 7 professional 64bit i only have one user account, and i am the computer administartor. every other program works fine but visual studio programs.
View 2 Replies
Feb 12, 2011
I have developed an application where i am drawing line using the mouse like a pen (it can be of any shape) i want to save the location of the object and redraw it later using the drawn location saved on any xml or text file. Instead of saving the edited image i want to save the location only to save the space in the sql server.
View 2 Replies
Jul 8, 2009
The VB2K8 Express IDE is hanging intermittantly when I click on the form's Design tab. The tab's work area goes blank and a wait cursor appears. I can't switch tabs or do anything else within the IDE at this point. I have to go to the Task Manager, end the VB taskk, and restart the IDE. VB is at SP 1 with .NET 3.5. I have no third party add-ins or controls except for the Visual Basic Power Packs which aren't being used. At this point it is annoying and I haven't lost anything yet but it is happening more frequently over time.
View 4 Replies
Mar 17, 2012
I am using a button on a form which creates a chart at runtime when the user clicks the button. it works ok for the first time but when I select the button the second time I get a square diagonal box or indexoutofrange Exception.Note: I have another button that clears the series from the chart before reselecting the button that creates the chart.
Below is the code segment
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Static Dim counter As Integer = 0
[Code].....
View 1 Replies
Jun 23, 2011
How do capture which button caused the postback on a web form with multiple controls using asp.net
View 3 Replies
Mar 10, 2011
how do I handle the errors that may appear from the user of my program. For example, I have an triangle area program in wich I ask the user of the program to insert the length of the base and height of the triangle in a textbox. But what if he inserts a letter or something else, like a sign....my program will crash...
I know that one method would be to use On Error GoTo but I don't know how. If maybe you can direct me to some link or you could explain how do I handle errors, I would be grateful. Maybe you can even show me other ways to avoid errors from the user input.
This is my small program so far:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Handles Button1.Click
Dim , Height, ARIA As Integer
[Code]....
View 3 Replies
Mar 29, 2011
I've got a small app which I use to start a 3rd party application. When run from a shortcut the VB app starts the 3rd party app to and when loaded it displays its own file/folder interface, the VB app the closes itself. However, if you open a file in explorer associated with the 3rd party app, the 3rd party application loads and opens the file itself and not the file/open interface.
Uh OK, so what's the problem??The issue is I have changed the file extension associated with the 3rd party app to now use my VB app. I can successfully open files with the app from explorer if there are no spaces in the file or folder path however if there are, the 3rd party app opens and displays a File not found error message and gives the path up to the point where the space then follows.The relevant snippets of code from the app relating to the issue is below, specifically Dim Arguments variable where I am not quite sure how my string cocantenation should be to deal with the value of the variable 'Filename' which may or may not contain spaces.
[code]...
View 26 Replies
Aug 26, 2009
I've got a basic idea of what i'm wanting to do, just been out of it too long to remember how to do it. I'm wanting to load an image, not display it. Get all the pixel data, then redraw the image pixel for pixel in mspaint.
View 16 Replies
Jun 19, 2012
I uses datagridview for show query results from database which may have 0 to x number of rows. So I made calculation to calculate size of underlaying form and my datagridview dependable on number of matched rows. Underlying form is transparent and all of that looks like user control what appears and works just fine. But here is one issue: Every time datagrid have to grow, black square in that area is showed before datagrid is filled, what is not nice and surely unwanted. Did datagridview have some mechanism to freeze it and show data when populating is finished?
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim tw As Integer = 0
Dim n As Integer = 0
Dim sqlText As String
Dim reader As OdbcDataReader = Nothing
[Code] .....
View 1 Replies
Feb 9, 2012
I have a DataGridView with a single column that currently displays a short list of items. When the user clicks a button to run an update, each row/cell is read and processing begins. I would like to have the selection idicator move down the rows in the DataGridView as it completes processing of each record. How can I display the iteration of the DataGridView rows while the processing is underway? A redraw of the DataGridView or something.This is a VB.net windows form, I know how to do this with AJAX I think, but how can I in a Windows form?
View 1 Replies
May 26, 2010
I have a semi-transparent custom control in vb2005 - works fine, except I can't get it to update/refresh correctly. If I update the custom parameter _backgroundColor, the control appears to be overpainted - e.g. each attempt to update the colour of the control overpaints the existing colour - until it becomes a solid block of colour. However, forcing a refresh of the form makes the control display the correct colour. Any ideas? I don't want to have to repaint the form just to get this control to render correctly. Code for the custom control is below.
[Code]...
View 1 Replies
Apr 12, 2012
In my windows application, I want to check which part of code (or routine) has caused un-handled exception event to occur from application events in its running mode (not debugging).
If this is possible then please guide me how to do this.
If any clarification regarding this is required,
View 16 Replies