Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Set rsTest = New ADODB.Recordset

With
.Append "Field1", adBSTR
.Append "Field2", adBSTR
.Append "Field3", adBSTR
End With

rsTest.Open

With rsTest
.AddNew
.Fields("Field1") = "Test1"
.Fields("Field2") = "Test2"
.Fields("Field3") = "Test3"
.Update
End With
Set DataReport1.DataSource = rsTest
With DataReport1.Sections("Section1")
.Controls("Text1").DataField = "Field1"
.Controls("Text2").DataField = "Field2"
.Controls("Text3").DataField = "Field3"
End With
DataReport1.Refresh
DataReport1.Show 1
End Sub
Naruse commented: This snippet realy help me. Thank you :) +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Create a recordset to Accomodate related item then set datareport recordset to it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Make sure that your table (login) is exists in your database and table name spell correctly.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I think Hericles was given the direction.
You need to know how to make connection with databases (MSSQL,MySQL,Oracle,etc). Connectionstring.com provides you how to do it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

>> All works very well, but I cannot restore the form.
What you mean about cannot restore?
I tried the code and it works great. I can restore it too.
After minimize the form, left click the icon on system tray taskbar Or
You can right click the icon and select restore.

Jx_Man 987 Nearly a Senior Poster Featured Poster

For transparency form see this thread and this thread too

Jx_Man 987 Nearly a Senior Poster Featured Poster

hi.....im jennylyn,i would like to ask you guys if what would be a code for SEARCH in database....like if we would find the name or gender????pls post a code guys....need it in our activity!!!!!!thanks..............

Post your own thread here. Also post the code you working on.

Jx_Man 987 Nearly a Senior Poster Featured Poster

As i remember there are code to make a GUI for matlab.

Jx_Man 987 Nearly a Senior Poster Featured Poster

>> I hope you do not mind the constant questions. I am still a beginner
Its okay.. Enjoy Daniweb :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

You can check file name length..

Dim streamer As IO.StreamReader
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    OpenFileDialog1.ShowDialog()
    If OpenFileDialog1.FileName.Length > 0 Then
        TextBox1.Text = OpenFileDialog1.FileName
        streamer = IO.File.OpenText(TextBox1.Text)
        Dim mystring() As String = streamer.ReadToEnd.Split(vbNewLine)
        ListBox1.Items.AddRange(mystring)
    End If
End Sub
Aleksej commented: Thx Jx +1
Neji commented: As always +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Don't put Remaining items on purchasing table.
Put it on their own table. (e.g Reebok, Adidas,..)
So you just update Stock Field in related table (adidas or reebok, etc) every transactions recorded in table purchase.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Option Explicit
Dim X As Integer, Y As Integer 'Declare variable X and Y as Integer 

Private Sub Form_Load()
    ' This following code to assing variable X and Y with Width and Height of Form
    X = Me.Width 'assign variable X with form Width 
    Y = Me.Height 'assign variable Y with form Height
	
    'This following code to set Width and height of Form To 0
    Me.Width = 0 ' Set form Width to 0
    Me.Height = 0 ' Set form Height to 0
	
    ' This following to centered form
    Me.Left = (Screen.Width - Me.Width) / 2 ' Set Left with (Width of your computer screen -  Width of form) then Divide it by 2
    Me.Top = (Screen.Height - Me.Height) / 2 ' Set Top with (Height of your computer screen -  Height of form) then Divide it by 2
End Sub

'THis for Opened Form Animation
Private Sub Timer1_Timer()
 'Timer for the opening event
' This following code will  bringin back Form Size.. 
' form will increase width by 400 and Height by 350. So it will seems like animation..

' This following code will bring the Form Width Size
If Me.Width < X Then ' If Width of Form < X  (X is Form Width. Look at asiggnment in form load)
	Me.Left = (Screen.Width - Me.Width) / 2 'Set Left with (Width of your computer screen -  Width of form) then Divide it by 2. This for centered form
	Me.Width = Me.Width + 400 ' Form Width will …
Vega_Knight commented: Very good explanation +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub cmdAddItem_Click()
Static count As Integer
Static name As String
count = lstPoints.ListCount
count = count + 1
name = "Point " & count
lstPoints.AddItem name

If count = 8 Then
    cmdAddItem.Enabled = False
    cmdRemoveItem.Enabled = True
End If
End Sub

Private Sub cmdRemoveItem_Click()
Size = lstPoints.ListCount - 1
lstPoints.RemoveItem Size

If lstPoints.ListCount = 0 Then
    cmdRemoveItem.Enabled = False
    cmdAddItem.Enabled = True
End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Thank you for your response.
I went through all the suggestions but in the last part, I'm still having problems in 'clearing' the array and start new order.
Yes the command that you provided clears all the strings but when I start new order (ButtonNewOrder) the previous output (TotalItems) is saved and added to the 'New' (TotalItems). I will keep looking for a solution and I will post it with the corrected code if I'm done.

ChrisPadgham already answered it. just put that the code in button new order event.

Jx_Man 987 Nearly a Senior Poster Featured Poster

1. Total
You can get total from TotalCost variabel since you already count it TotalCost += OrderMenu(1).ItemCost But you put the declaration in every buttons so you can't use it properly.
You need to put TotalCost in Global Declaration and remove all TotalCost declaration in every buttons.

Private OrderMenu(6) As MenuItems
Dim Dim TotalCost As Decimal
...

You can access it in ButtonDone event : MsgBox(TotalCost) 2. Clear TextBoxBill

Private Sub ButtonNewOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonNewOrder.Click
    'Clears the TexBoxBill and start new order
    TextBoxBill.Text = String.Empty
End Sub

3. Hamburger Problem
Your code not complete like others. You missing '+' sign.
Just change this line :

...
TextBoxBill.Text += OrderMenu(1).ItemName.ToString & vbTab & OrderMenu(1).ItemCost.ToString & vbCrLf
Jx_Man 987 Nearly a Senior Poster Featured Poster

You can use Timer control.
Set Enabled=True on Timer properties
Set Interval as you needed. Interval in milliseconds. (e.g 1000 = 1 Second)

Then put your checking code in Timer event :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    ' Your Code        
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
        Dim i As Integer = DataGridView1.CurrentRow.Index
        With DataGridView1
            TextBox1.Text = DataGridView1.Item(0, i).Value
            TextBox2.Text = DataGridView1.Item(1, i).Value
            TextBox3.Text = DataGridView1.Item(2, i).Value
        End With
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

>> I need a text box for entering only for 0 to 9,.,Delete key ,Backspace key and Enter key

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Or Asc(e.KeyChar) = 13 Then
            e.Handled = True
        End If
        If Asc(e.KeyChar) = 8 Then
            e.Handled = False
        End If
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Can anyone help me by giving out a complete tutorial on the step by step way a connecting to a database using VB6?

Post your code. How far you doing this?

Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

Thanks everyone, for all your help, I've managed to sort the problem out. :D

Great Job collin_ola. So, Would you like to share the answer..?
It will help another member who has the same problem like you. :D

Thank you :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

i want to remove single items from list and want to keep duplicate items in listbox

You mean just remove selected item?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Remove selected items :

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        For i As Integer = 0 To ListBox1.SelectedIndices.Count - 1
            ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
        Next
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

See this link.
counter usually used in loop.
For me all those variables can be a counter depend on the case, but if i have to choose one then i would choose the last one.

Jx_Man 987 Nearly a Senior Poster Featured Poster

You're welcome.
If solved then mark it as solved :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

So, What the error of your program?
I don't get what exactly you want to ask?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Yes. You need to add one column again as Key to identifier them.
Named it as you want (e.g ID or dbId or dbNum).
With this column every record will get one unique key to be identified.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Its not an error.
When you edit data your program will edit all record with name 'jones'.
Since you didn't have an key/Id to know which 'jones' to edit.
I suggest you to add Id Column as Key. So you can identifier which record to edit even they have the same name.
e.g :

Id  Surename  Forename Phone
1   jones     ward     12345
2   jones     ward     54321

Even they have same name but you can edit current jones with using their 'Id'.

ITKnight commented: Good point. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

All can be counter variable.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't really know why it doesn't work for you.
This a simple test of passing text.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Well..its strange. it always works for me.
did you have made the object of form customer?

Dim frmCustomers as New formCustomers

frmCustomers.txtFirstName.Text = dSet.Tables("Customers").Rows(incr + 1).Item(2)
frmCustomers.txtLastName.Text = dSet.Tables("Customers").Rows(incr + 1).Item(3)
Me.Hide()
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try to hide the form. don't close it. Me.Hide()

Jx_Man 987 Nearly a Senior Poster Featured Poster

You can use SQL aliases on your sql query.
e.g :

select Name as '1', City as '2' from Address
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster
formCustomers.txtFirstName.Text = dSet.Tables("Customers").Rows(incr + 1).Item(2)
formCustomers.txtLastName.Text = dSet.Tables("Customers").Rows(incr + 1).Item(3)
Me.Close()

Actually you can pass value if form search still active.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try to Pass value before Close the form Search.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

1 Module, 1 textbox

In Module :

Option Explicit

Public OldWindowProc As Long

Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

Public Const GWL_WNDPROC = (-4)
Public Const WM_USER = &H400
' Pass along all messages except the one that
' makes the context menu appear.
Public Function NoPopupWindowProc(ByVal hWnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Const WM_CONTEXTMENU = &H7B

    If msg <> WM_CONTEXTMENU Then _
        NoPopupWindowProc = CallWindowProc( _
            OldWindowProc, hWnd, msg, wParam, _
            lParam)
End Function

In Form :

Option Explicit
Private Sub Form_Load()
    ' Set the control's new WindowProc.
    OldWindowProc = SetWindowLong( _
        txtMenuDisabled.hWnd, GWL_WNDPROC, _
        AddressOf NoPopupWindowProc)
End Sub
' Restore the original WindowProc.
Private Sub Form_Unload(Cancel As Integer)
    SetWindowLong _
        txtMenuDisabled.hWnd, GWL_WNDPROC, _
        OldWindowProc
End Sub
Neji commented: Thank you. It worked very nice. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Use API calls.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

dtpEqualTo.Value.ToString("yyyy-MM-dd")
Jx_Man 987 Nearly a Senior Poster Featured Poster

Still use 'DATE', Date also save the time.

create table class
	(schedule_num		integer primary key not null, 
	 semester		varchar(10), 
	 course_name		varchar(14),
	 credit			int,
	 department		varchar(15),
	 meeting_time		DATE,
	 meeting_place 		varchar(20),
	 enrollment_limit	int);

Example :

select to_char(meeting_time,'HH24:MI:SS') from class
Jx_Man 987 Nearly a Senior Poster Featured Poster
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Info As New FileInfo("D:\000.jpg")
    MsgBox("Name : " & Info.Name & vbCrLf & _
        "Length : " & Info.Length & " bytes" & vbCrLf & _
        "Type : " & Info.Extension & vbCrLf & _
        "Date Created : " & Info.CreationTime & vbCrLf & _
        "Path : " & Info.DirectoryName & vbCrLf & _
        "Full Path : " & Info.FullName)
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

You writing the code use C# or VB.Net?
May you forgot to Change the equal sign (=) with slash (/) and Remove the "watch?" string.

Jx_Man 987 Nearly a Senior Poster Featured Poster
Label1Display.Text = Stacks(0).ToString
Label2Display.Text = Stacks(1).ToString
Label3Display.Text = Stacks(2).ToString
Label4Display.Text = Stacks(3).ToString
Label5Display.Text = Stacks(4).ToString
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Private Sub Streching()
    Picture1.ScaleMode = 3
    Picture1.AutoRedraw = True
    Picture1.PaintPicture Picture1.Picture, _
        0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, _
        0, 0, _
        Picture1.Picture.Width / 26.46, _
        Picture1.Picture.Height / 26.46
    Picture1.Picture = Picture1.Image
End Sub

Private Sub Form_Load()
Streching
End Sub
Estella commented: To true.. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Function to check if stack empty or not :

Private Function IsEmpty() As Boolean
    If Stacks.Count = 0 Then
        Return True
    Else
        Return False
    End If
End Function

how if I need to show these inputs (userMsg) in a (label) ? To find out what is the user entering (Pushing) into the stack

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    If IsEmpty() Then
        MsgBox("No elements in stack")
    Else
        Label1.Text = Stacks(0).ToString) 'Show the top of stack (last inputted data)
    End If
End Sub

what is going to be left after I (Pop) the items ?

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim i As Integer
    ListBox1.Items.Clear()
    If IsEmpty() Then
        MsgBox("No elements in stack")
    Else
        For i = 0 To Stacks.Count - 1
            ListBox1.Items.Add(MyStack(i).ToString) ' load all data in stack to listbox
        Next
    End If
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Where is your stack declaration? Dim Stack(4) As String -> Your Declaration is for array

You need to declare stack before add it. Dim MyStack as New Stack(4) -> This for Stack

To Add stack MyStack.Push(userMsg )

' Declare as global variable
Dim MaxSize As Integer = 4
Dim MyStack As New Stack(maxsize)

Private Sub Button1Push_Click(sender As System.Object, e As System.EventArgs) Handles Button1Push.Click
       
        Dim userMsg As String

        userMsg = InputBox("Push", "Stacks", "Enter your letter here", 500, 500)
        If MyStack.Count <= MaxSize Then
            MyStack.Push(userMsg)
        Else
            MsgBox("Stack is Full")
        End If
End Sub

Private Sub Button2Pop_Click(sender As System.Object, e As System.EventArgs) Handles Button2Pop.Click
    MsgBox(MyStack.Pop) ' Remove and return object at the top of stack
End Sub
Naruse commented: Really Good explanation +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Post your code. So we can fix it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Private Sub OpenFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFormToolStripMenuItem.Click
        Dim NewForm As New Form1
        NewForm.Show()
    End Sub