Search the Community
Showing results for tags 'error'.
-
Hi, I am wondering how do I minimize a windowed DirectX application without getting an application error. Like in various tutorials, I captured the OnDeviceLost event, but what do I have to put inside it? The application displays a simple cube without textures and it uses 1 light. There is no rendering loop running. The rendering block is called only if needed (i.e. setting viewer position, setting light color etc.).
-
hey. i'm making a very basic contacts type program, and one of the fetures is that when the user closes the form it checks is any information has not been saved. but for some reason once i placed this sub in it now doesn't close at all Private Sub FormClosing() Handles Me.FormClosing Dim IsDiffrent As Boolean = True For Counter As Byte = 0 To COM_Name.Items.Count - 1 If COM_Name.Text = COM_Name.Items.Item(Counter) Then Dim Information(0 To 7) As String Dim TxtReader As New StreamReader(My.Application.Info.DirectoryPath & "\" & COM_Name.Text & ".txt") For InfoCounter As Byte = 0 To 7 Information(InfoCounter) = TxtReader.ReadLine Next TxtReader.Close() If Information(0) = TXT_HomePhone.Text And _ Information(1) = TXT_MobPhone.Text And _ Information(2) = DTP_Birthday.Value And _ Information(3) = TXT_HomeAddress.Lines(1) And _ Information(4) = TXT_HomeAddress.Lines(2) And _ Information(5) = TXT_HomeAddress.Lines(3) And _ Information(6) = TXT_HomeAddress.Lines(4) And _ Information(7) = TXT_Email.Text Then IsDiffrent = False End If End If Next If IsDiffrent = True Then Dim Answer As Byte = MsgBox("Do you wish to Save Changes?", MsgBoxStyle.YesNo) If Answer = 6 Then Call Save(True, "Closing") End If Else Me.Close() End If End Sub (please note that it is not even getting to the save changes msgbox)
-
hi all. I've been trying to make a basic version of mine sweeper. when i ran the program it did not give me all the expected outputs. i have tracked back the error to this bit of code that i have eddited down to just the bits that dont run and the context in which the code makes sence... can anyone see the problem Dim Xlength As Integer = 5 - 1, _ YLength As Integer = 5 - 1, _ chosen(0 To Xlength, 0 To YLength) As Boolean, _ value(0 To Xlength, 0 To YLength) As Integer, _ NoOfMines As Integer Private Sub set_board() Handles Me.Load NoOfMines = (((Xlength + 1) * (YLength + 1)) ^ 0.5) - 1 For FirstD As Integer = 0 To Xlength For SecondD As Integer = 0 To YLength chosen(FirstD, SecondD) = False value(FirstD, SecondD) = 0 Next Next Dim RandomD1, RandomD2 As Integer Randomize() For counter As Integer = 1 To NoOfMines Do RandomD1 = Rnd() * Xlength RandomD2 = Rnd() * YLength Loop Until chosen(RandomD1, RandomD2) = False chosen(RandomD1, RandomD2) = True Next Dim number As Integer For FirstD As Integer = 0 To Xlength For SecondD As Integer = 0 To YLength If chosen(FirstD, SecondD) = False Then number = 0 For X As Integer = -1 To 1 For Y As Integer = -1 To 1 If chosen(FirstD + X, SecondD + Y) = True Then number += 1 Next Y Next X value(FirstD, SecondD) = number Else value(FirstD, SecondD) = -1 End If Next SecondD Next FirstD End Sub i have tryed message boxing parts out and it seems to just stop funning the code at If chosen(FirstD + X, SecondD + Y) = True Then number += 1. MS visual basic 2010 is not giving me any errors, can anyone help me out
-
hi, im trying to make a simple search tool for an array read from a .txt file. The .txt file has two types of items, movies and games and looks like this for example: M0001;DVD;The Hours;Nicole Kidman, Meryl Streep;Stephen Daldry;10 G0004;PlayStation 2;Spy Hunter 2;12 the file is read in a FileReader class which has an if statement specifying whether the item is a movie or a game. The 'Movie' and 'Game' classes are inherited from a class called 'RentalItem'. In the method im writing that does the actual search i have this and it works fine: rentalList = new ArrayList(); rentalList = FileReader.readRentalItems(); public string QueryMovieItem (string title, string actor, string director) foreach (RentalItem m in rentalList) { if (m.Title == title) sb.Append(m.ItemId + ", " + m.Title + ", copies: " + m.Copies + "\n\n"); }[/Code] however the following highlights "Movie" and generates the error "unable to cast object of type 'VideoStore.Game' to 'VideoStore.Movie" : [code]foreach (Movie m in rentalList) { if (m.Director == director) sb.Append(m.ItemId + ", " + m.Title + ", copies: " + m.Copies); } can anyone tell me why this is happening and how i can possibly fix it. thanks in advance :)