Click here to Skip to main content
15,896,527 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Trying to save more then one textbox ?? Pin
Bob Beaubien10-Sep-09 8:02
Bob Beaubien10-Sep-09 8:02 
GeneralRe: Trying to save more then one textbox ?? Pin
εїзεїзεїз10-Sep-09 10:34
εїзεїзεїз10-Sep-09 10:34 
GeneralRe: Trying to save more then one textbox ?? Pin
Bob Beaubien10-Sep-09 10:37
Bob Beaubien10-Sep-09 10:37 
GeneralRe: Trying to save more then one textbox ?? Pin
Christian Graus10-Sep-09 12:16
protectorChristian Graus10-Sep-09 12:16 
QuestionHow we recognition Time Between 2 Time??? Pin
faravani9-Sep-09 18:48
faravani9-Sep-09 18:48 
AnswerRe: How we recognition Time Between 2 Time??? Pin
Christian Graus9-Sep-09 18:54
protectorChristian Graus9-Sep-09 18:54 
AnswerRe: How we recognition Time Between 2 Time??? Pin
εїзεїзεїз10-Sep-09 6:47
εїзεїзεїз10-Sep-09 6:47 
Questionnumbrix puzzle Pin
rbjanaki9-Sep-09 15:21
rbjanaki9-Sep-09 15:21 
I have to design, write and test a vb program to help the user solve the "Numbrix" puzzle.

The user should have the capability to "undo" a number of steps taken in order to take another path it he current path is unworkable

so far I had this, I am able to crate a dynamic array of text boxes and load a from

Imports System.IO
Imports System.Math

Public Class Form1

    Structure rect
        Dim rec(,) As TextBox, val(,) As Byte, yy(,,) As Boolean
        Sub disp(ByVal a As Integer, ByVal b As Integer)
            Dim st As String = ""
            For i As Integer = 1 To 9
                If yy(a, b, i) Then st &= i.ToString

            Next
            rec(a, b).Text = st
        End Sub

        Sub comp(ByVal a As Integer, ByVal b As Integer)
            Dim i, j, cnt As Byte
            For i = 1 To 9
                If yy(a, b, i) Then
                    cnt = CByte(cnt + 1)
                    j = i

                End If
            Next
            If cnt = 1 Then val(a, b) = j
        End Sub
    End Structure

    Dim xx(3, 3) As rect, done As Boolean, diff As Byte


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles MyBase.Load
        Dim pt1, pt2 As Point, rec As Size
        rec.Width = 47 : rec.Height = 29
        pt1.X = 25 : pt1.Y = 25
        For r As Integer = 1 To 3
            For c As Integer = 1 To 3
                ReDim xx(r, c).rec(3, 3), xx(r, c).val(3, 3), xx(r, c).yy(3, 3, 9)
                pt2 = pt1
                For rr As Integer = 1 To 3
                    For cc As Integer = 1 To 3
                        Dim newtb As New TextBox : Me.Controls.Add(newtb)
                        newtb.Size = rec : newtb.Multiline = True
                        newtb.TextAlign = HorizontalAlignment.Center
                        newtb.Location = pt2 : pt2.X += 46
                        If c = 2 And (r = 1 Or r = 3) Or r = 2 And (c = 1 Or c = 3) _
                        Then newtb.BackColor = Color.LightGray
                        xx(r, c).rec(rr, cc) = newtb
                    Next
                    pt2.X = pt1.X : pt2.Y += 28
                Next
                pt1.X += 140

            Next
            pt1.X = 25 : pt1.Y += 86
        Next
    End Sub

    Private Sub LoadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadButton.Click
        Dim lin(8) As String, filRead As StreamReader, i, x, t, d As Integer
        Dim openFile As New OpenFileDialog()
        openFile.Filter = "txt.Files(*.txt)|*.txt"          openFile.InitialDirectory = "\C:\Fall09\numbrix\numbrix\TextFile1.txt"
        If openFile.ShowDialog() = DialogResult.OK Then
            MessageBox.Show(openFile.FileName)
        End If

        filRead = New StreamReader(openFile.FileName)
        diff = CByte(filRead.ReadLine())
       
        For r As Integer = 1 To 3
            For rr As Integer = 1 To 3
                lin = filRead.ReadLine.Split() : i = 0
                For c As Integer = 1 To 3
                    For rc As Integer = 1 To 3
                        If lin(i) <> "00" Then
                            x = Integer.Parse(lin(i))
                            If x > 0 Then xx(r, c).rec(rr, rc).ForeColor = Color.Red
                            x = Abs(x)
                            xx(r, c).rec(rr, rc).Text = x.ToString
                            For j As Integer = CInt(Int(Log10(x))) To 0 Step -1
                                If j = 0 Then xx(r, c).val(rr, rc) = CByte(x)
                                t = CInt(10 ^ j)
                                d = x \ t : x = x Mod t
                                xx(r, c).yy(rr, rc, d) = True
                            Next

                        End If
                        i += 1
                    Next
                Next
            Next
        Next

        filRead.Close()
    End Sub
End Class

AnswerRe: numbrix puzzle Pin
Luc Pattyn9-Sep-09 15:25
sitebuilderLuc Pattyn9-Sep-09 15:25 
AnswerRe: numbrix puzzle Pin
Christian Graus9-Sep-09 16:07
protectorChristian Graus9-Sep-09 16:07 
AnswerRe: numbrix puzzle Pin
rbjanaki9-Sep-09 16:15
rbjanaki9-Sep-09 16:15 
GeneralRe: numbrix puzzle Pin
Christian Graus9-Sep-09 16:42
protectorChristian Graus9-Sep-09 16:42 
GeneralRe: numbrix puzzle Pin
εїзεїзεїз10-Sep-09 7:19
εїзεїзεїз10-Sep-09 7:19 
GeneralRe: numbrix puzzle Pin
rbjanaki10-Sep-09 8:06
rbjanaki10-Sep-09 8:06 
Questionappend line number to a text file [SOLVED] [modified] Pin
cjdc9-Sep-09 13:53
cjdc9-Sep-09 13:53 
AnswerRe: append line number to a text file Pin
Christian Graus9-Sep-09 14:20
protectorChristian Graus9-Sep-09 14:20 
GeneralRe: append line number to a text file Pin
cjdc9-Sep-09 14:29
cjdc9-Sep-09 14:29 
GeneralRe: append line number to a text file Pin
Christian Graus9-Sep-09 14:48
protectorChristian Graus9-Sep-09 14:48 
GeneralRe: append line number to a text file Pin
cjdc9-Sep-09 14:57
cjdc9-Sep-09 14:57 
GeneralRe: append line number to a text file Pin
Christian Graus9-Sep-09 15:05
protectorChristian Graus9-Sep-09 15:05 
AnswerRe: append line number to a text file Pin
Luc Pattyn9-Sep-09 15:21
sitebuilderLuc Pattyn9-Sep-09 15:21 
GeneralRe: append line number to a text file Pin
cjdc10-Sep-09 7:03
cjdc10-Sep-09 7:03 
GeneralRe: append line number to a text file Pin
Luc Pattyn10-Sep-09 7:12
sitebuilderLuc Pattyn10-Sep-09 7:12 
AnswerRe: append line number to a text file Pin
Hurricane300010-Sep-09 8:12
Hurricane300010-Sep-09 8:12 
GeneralRe: append line number to a text file Pin
cjdc10-Sep-09 9:09
cjdc10-Sep-09 9:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.