Jump to content
Xtreme .Net Talk

cugone

Members
  • Posts

    19
  • Joined

  • Last visited

Everything posted by cugone

  1. The user clicks on a menuitem then this code executes: ''' <summary> ''' Gets the update information. ''' </summary> ''' <remarks></remarks> Friend Sub GetUpdate() If My.Computer.FileSystem.FileExists(MainForm.Path & "newVersion.txt") Then My.Computer.FileSystem.DeleteFile(MainForm.Path & "newVersion.txt") End If Dim baseUri As New Uri("http://www.blisspointranch.com/") Dim basePath As New Uri(baseUri, "programs/charactersheet/") Dim filePath As New Uri(basePath, "version.txt") 'Disable menu item. MainForm.menuitemUpdate.Text = "Checking for Updates..." MainForm.menuitemUpdate.Enabled = False 'Try to download file. If can't: Display returned server error, re-enable menus, exit subroutine. Try MainForm.webclient.DownloadFileAsync(filePath, MainForm.Path & "newVersion.txt") Catch ex As UriFormatException MessageBox.Show("Could not check for new version, server reported an error: " & vbCrLf & _ ex.Message & vbCrLf & _ "If this problem persists contact the program vender for support.", _ My.Application.Info.Title, _ MessageBoxButtons.OK, _ MessageBoxIcon.Error) Catch ex As WebException MessageBox.Show("Could not check for new version, server reported an error: " & vbCrLf & _ ex.Message & vbCrLf & _ "If this problem persists contact the program vender for support.", _ My.Application.Info.Title, _ MessageBoxButtons.OK, _ MessageBoxIcon.Error) Catch ex As InvalidOperationException MessageBox.Show("Could not check for new version, server reported an error: " & vbCrLf & _ ex.Message & vbCrLf & _ "If this problem persists contact the program vender for support.", _ My.Application.Info.Title, _ MessageBoxButtons.OK, _ MessageBoxIcon.Error) Finally MainForm.menuitemUpdate.Text = "Check for Updates..." MainForm.menuitemUpdate.Enabled = True End Try End Sub
  2. ...works fine for my purposes for checking for a new file version, but it still locks up the UI when it is connecting to the server. Once it connects, the UI unlocks but I'd like to eliminate the brief 3 second lag it causes.
  3. Because they explain next to nothing; just "this is the code to do this thing not related at all to the text I've written" or "here, practice doing this thing I haven't talked about AT ALL or given examples of AT ALL."
  4. Wrox and Apress in my experience are very good books. In addition, most anything published from Microsoft Press, O'Reilly, and Thompson Course Technology are also very informative. However, do NOT, under any circumstances, get anything in the "Shelly Cashman Series" from Thompson Course Technology, the two head writers are horrible at what they do.
  5. I was thinking about that, but the "list..." prefixed objects are not controls, they are List (Of T) objects.
  6. I have the following code: Select Case localType Case "Relations" i = 0 For j = 0 To Me.listRelations.Count - 1 li.SubItems.Add(New ListViewItem.ListViewSubItem()) li.Text = Me.listRelations.Item(j).Name i += 1 li.SubItems(i).Text = Me.listRelations.Item(j).Relation 'Copy listview item, attempt to store into array. li_copy = TryCast(li.Clone(), ListViewItem) If li_copy Is Nothing Then MessageBox.Show("There was an error inserting record " & _ (ItemCount + 1).ToString & _ " into the list. It contains invalid data or is empty.", _ My.Application.Info.Title, _ MessageBoxButtons.OK, _ MessageBoxIcon.Error) Continue For Else ReDim Preserve aryItems(ItemCount) aryItems(ItemCount) = li_copy End If ItemCount += 1 'Reset values for populating with next record. li.SubItems.Clear() li.Text = "" li_copy = Nothing i = 0 Next j ... It repeats exactly as is multiple times with the exception of "listRelations" changes to one of many other different object names based on the select case at the time. I was wondering, is there a way to put this all in one subroutine and have the object acted on changed based on string parameters passed in?
  7. I've a custom class in a form that requires multiple instances of this class to be created and stored for later use, my question is: Which is more efficient? A strongly-typed List(Of T) of the objects or an array of said objects?
  8. I seem to remember reading the MSDN somewhere that there was another method to download files from URIs other than using the webclient object. I'm trying to download some raw php files but every time I use the webclient object the server interprets them as an HTTP request and instead serves the default web page that the php file builds and not the php code itself. Any suggestions? Using .NET 2005
  9. You can use Import Aliases. LongClass = Import Some.VeryLong.ClassNames EblaEnum = Import Some.VeryLong.ClassNames.eBla That way it's much shorter: Public Sub Blah LongClass.TestSub(EblaEnum) End Sub Other than that, I dunno. :/
  10. Define the Get Data Method as "Friend" then you can use it in the manner you already know.
  11. Well, that explains it. Apparently after writing a test case where I output all of my graphics device's capbilities "Powers of 2 Required" was true. Meaning I can only have textures that are square and a power of 2. :/ Nice of the documentation to actually EXPLAIN this. I had to read it from a reference book. :P
  12. Yeah, I'm using a spritebatch. I need to specify an origin and a clipping rectangle (source rectangle in the documentation) because it's a sprite sheet. Due to that, I'm forced to specify a scale. I noticed when I just use the default definition of (texture, position, tint) it still draws (the entire) texture way larger than it should, and blurry.
  13. I'll go ahead and poke around with it, but as it stands, is there a way to tell it NOT to scale and just use what's there? (you know, like what DirectX does NORMALLY)
  14. I'm having issues with sprite scaling in XNA. The original file is the size I want the various frames of the sprite sheet, but whenever I want the game engine to draw the texture it requests a "Uniform multiple to scale the height and width" or "a vector to scale the width and height by the x- and y- values". Problem is, telling it 1.0 scales by 100%, 0.0 scales it to 0, effectively erasing it, and scaling by 0.5 makes it roughly the size I want (not perfect), but BLURRY. :/ Any suggestions?
  15. I'm having trouble initializing a DirectX.DirectInput custom class Keyboard, I keep getting this error: "DLL 'C:\WINDOWS\assembly\GAC\Microsoft.DirectX.DirectInput\1.0.2902.0__31bf3856ad364e35\Microsoft.DirectX.DirectInput.dll' is attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang." Using Visual Studio 2005
  16. Thanks for the links, I figured it out. :]
  17. I have quite a few custom-designed classes that need to be notified when certain things happen pertaining to them, though, I've never delved into delegates and wouldn't even know where to start. How would I be able to write/use the events like the IDE does where you define an object and have all of it's events right there in a drop down. Would simply declaring it "WithEvents" work or is it more involved?
  18. cugone

    Class help

    Nothing against your educational institution of choice, but they should have started you on C++ to begin with...and not classes/db programming. Anyway, what's the text of the error it's throwing?
  19. Maybe I'm just crazy but for some reason, the VB documentation says that a Byte "Holds unsigned 8-bit integers ranging in value from 0 through 255", yet when I do something like: Dim small as Byte = 0 small += 1 VB complains up a storm. Is there simpler way to do simple increments/decrements or addition/subtraction to Bytes rather than: Dim small as Byte = 0 small += Convert.toByte(1) /everytime/? It's smart enough to truncate fractions, yet, it can't figure that 0000 0000 0000 0000 0000 0000 0000 0001 should be converted to 0000 0001. Sheesh. Done venting now. :P
×
×
  • Create New...