Jump to content
Xtreme .Net Talk

Moritain

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by Moritain

  1. You nailed it on the head Cags. I tried for some time to dynamically created and place my textboxes into the grid leaving a larger space in between each 3x3 grid. At some point quantum physics became necessary and I gave up on that approach, lol. I should mention at this point that I have only taken a single "Intro to VB� course at a junior college. This Sudoku program isn�t even a graded assignment; I just wanted to challenge myself, and get experience that could be used in my upcoming classes. On your suggestion Cags, I will revisit dynamic placement of my textboxes. Thanks.
  2. Sorry for the untimely reply, life has been a little crazy lately. Here is the section of code I�m trying to simplify. Private Sub frmSudoku_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Binds each cell of the Game Array to its corresponding Textbox on the form. Game(0, 0) = txt0 Game(0, 1) = txt1 Game(0, 2) = txt2 Game(0, 3) = txt3 Game(0, 4) = txt4 Game(0, 5) = txt5 Game(0, 6) = txt6 Game(0, 7) = txt7 Game(0, 8) = txt8 Game(1, 0) = txt9 Game(1, 1) = txt10 Game(1, 2) = txt11 Game(1, 3) = txt12 Game(1, 4) = txt13 Game(1, 5) = txt14 Game(1, 6) = txt15 Game(1, 7) = txt16 Game(1, 8) = txt17 Game(2, 0) = txt18 Game(2, 1) = txt19 Game(2, 2) = txt20 Game(2, 3) = txt21 Game(2, 4) = txt22 Game(2, 5) = txt23 Game(2, 6) = txt24 Game(2, 7) = txt25 Game(2, 8) = txt26 Game(3, 0) = txt27 Game(3, 1) = txt28 Game(3, 2) = txt29 Game(3, 3) = txt30 Game(3, 4) = txt31 Game(3, 5) = txt32 Game(3, 6) = txt33 Game(3, 7) = txt34 Game(3, 8) = txt35 Game(4, 0) = txt36 Game(4, 1) = txt37 Game(4, 2) = txt38 Game(4, 3) = txt39 Game(4, 4) = txt40 Game(4, 5) = txt41 Game(4, 6) = txt42 Game(4, 7) = txt43 Game(4, 8) = txt44 Game(5, 0) = txt45 Game(5, 1) = txt46 Game(5, 2) = txt47 Game(5, 3) = txt48 Game(5, 4) = txt49 Game(5, 5) = txt50 Game(5, 6) = txt51 Game(5, 7) = txt52 Game(5, 8) = txt53 Game(6, 0) = txt54 Game(6, 1) = txt55 Game(6, 2) = txt56 Game(6, 3) = txt57 Game(6, 4) = txt58 Game(6, 5) = txt59 Game(6, 6) = txt60 Game(6, 7) = txt61 Game(6, 8) = txt62 Game(7, 0) = txt63 Game(7, 1) = txt64 Game(7, 2) = txt65 Game(7, 3) = txt66 Game(7, 4) = txt67 Game(7, 5) = txt68 Game(7, 6) = txt69 Game(7, 7) = txt70 Game(7, 8) = txt71 Game(8, 0) = txt72 Game(8, 1) = txt73 Game(8, 2) = txt74 Game(8, 3) = txt75 Game(8, 4) = txt76 Game(8, 5) = txt77 Game(8, 6) = txt78 Game(8, 7) = txt79 Game(8, 8) = txt80 'Sets the .tag and .tabindex properties for each Textbox and displays a message to the user. For Row = 0 To 8 For Column = 0 To 8 Game(Row, Column).Tag = intNumber Game(Row, Column).TabIndex = intNumber intNumber = intNumber + 1 Next Next sbDisplay.Text = "Please press the Start button." End Sub Like I said before, the code I have works. It just seems to me that there should be some kind of loop for getting the same thing done without manually typing it all out. Cags� code and all other examples I have found to this point create new instances of textboxes with incrementing names. My problem is that I already have the textboxes created in my form and just want to bind each to a location in the array. Thanks again for any help. Moritain
  3. Thanks Cags. I had tried a similar set of code before with no success. Your code creates new instances that are not bound to the array. Way data in the array is changed it is not reflected in the 81 textboxes i have displayed on the form. I guess some things just have to be typed out.
  4. Hello im a college student learning VB.net and im trying to optimize a bit of code and could use some help. I created 81 textboxes in my form named textbox0, textbox1, . . . , textbox80. I also have a 2D array called Game(8,8) as Textbox. Heres my current code: Game(0,0) = Textbox0 Game(0,1) = Textbox1 Game(0,2) = Textbox2 . . . Game(8,8) = Textbox80 I would like a loop that automatically increments the numeric digits at the end of Textbox object name. Something along the lines of: Dim Row As Integer Dim Column As Integer Dim intCount As Integer = 0 For Row = 0 To 8 For Column = 0 To 8 Game(Row, Column) = "txt" & intCount Count += 1 Next Next Copy and paste got me through the first 81 textboxes of this project, but i want to expand the number of textboxes to a 16 x 16 grid, giving 256 total. Ive tried to research this problem, but feel like a a kid that doesn't know that the word "pharmacy" starts with a "P" and his teacher says to look it up in a dictionary, lol. I have found several threads on creating dynamic control instances. All my instances where created and placed in the design view, i just need to bind them to my array. For context, I'm trying to make a very generic Sudoku game ap. Thanks for any help offered.
  5. Sorry for the slow reply, its been a crazy this weekend. Thanks a ton, that code put me on the right track and with a few minor changes worked awesomely. Thanks again!
  6. Hello, I�m a sophomore student working towards a CS degree and I�m having problems with VB.net. I�m working on an assignment to create a Vending Machine App. I�ve got the whole thing ironed out but can�t seem to animate the dropping of the can. What I�m trying to do is capture the location of a PictureBox and then make a another PictureBox move down 20 pixels every 100ms. The effect I�m hoping for is a kinda-sorta animation of a can falling into to the bottom of the machine. I�m using this Sub as my pause: Private Sub Wait(ByVal Time As Integer) For X As Integer = 1 To Time System.Threading.Thread.CurrentThread.Sleep(100) Application.DoEvents() Next End Sub This is the best trial I have had so far after several hours of trying code samples from the net: Private Sub DropTheCan() picCanDrop.Visible = True Do While picCanDrop.Location.Y < 360 picCanDrop.Location = New Point(picCanDrop.Location.Y - 20) Loop End Sub I get a flicker, albeit, in the wrong location. Any help would be greatly appreciated. Thank You.
×
×
  • Create New...