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
Jx_Man 987 Nearly a Senior Poster Featured Poster

You have 'typ' attribute. you can use it :

If ((resp = "y") Or (resp = "Y")) Then
    prequa = PrimePrice
    typ = "Premium"
Else
    prequa = RegularPrice
    typ = "Regular"
End If

Then change this line :

Console.WriteLine(vbLf & "Quality : " & typ)

Also : Private prequa As String it should be : Private prequa As Double total = quan * prequa --> You can't multiply Double with String. it must same type.

EkoX commented: Great +1
Jade_me commented: Great +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

I try changing it prequa = True to prequa = 13.08 but it didn't work so what can you do?

You can't. prequa type is Boolean (True or False). Prequa can't accept another value except true or false.
Make new variable as a Double or change the type of prequa from Boolean to Double.

Sawamura commented: Helpfull as always.. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

thx it was only that easy

So it's already solved?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Okay. Line 21 : Console.Write(name("Do you want premium y/n")) It should be Console.Write(name + " Do you want premium y/n")

Jx_Man 987 Nearly a Senior Poster Featured Poster

Error occur in which line?

Jx_Man 987 Nearly a Senior Poster Featured Poster

You wrong when put commas n single quotes. did u see my post?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Don't Use AND

Query = "INSERT INTO PROD_DB_Complete_Board (ID, [Board Size], Laminate, [Stock Level]) Values('" & TextBox4.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox1.Text & "')"
Jx_Man 987 Nearly a Senior Poster Featured Poster
Query = "update Prod_DB_Completed_Board set [Stock Level] = '" & TextBox2.Text & "' where Laminate = '" & ComboBox2.Text & "'" & "AND" & "'" ComboBox3.Text & "'"

Missing Other Column Name :

"AND OtherColumName = " & "'" ComboBox3.Text & "'"
Jx_Man 987 Nearly a Senior Poster Featured Poster

Seems He/she already solved it,a few minutes after this thread posted:)

Vega_Knight commented: :p +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

>> Is it possible to have the menu and header static and loads each form in one dynamic container.
Yes. You can make parent-child form.
Say Form1 as the container/parent and form2 as child.
Set IsMdiContainer in Form1 Properties as True.
In menu event :

Dim a As New Form2
 a.MdiParent = Me
 a.Show()
Hawk123 commented: cool +1
Jx_Man 987 Nearly a Senior Poster Featured Poster

Yes. Good Job..
I not have compiler installed right now. so i forgot that windows cannot save symbols like "/" as an address.
Don't forget to mark this thread as solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

SaveFileDialog1.FileName = Date.Now
Jx_Man 987 Nearly a Senior Poster Featured Poster

Or you can check the length of filename.

If OpenFileDialog1.FileName.Length > 0 Then
    Dim loader As New IO.StreamReader(OpenFileDialog1.FileName)
    TextBox1.Text = loader.ReadLine
    TextBox2.Text = loader.ReadLine
    ...
    loader.Close()
End If
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Dim StartPos, Counter As Integer
    Dim FindString, ReplaceText As String
    FindString = "test"
    ReplaceText = "MyString"
     
    For Counter = 1 To Len(Text1.Text)
            StartPos = InStr(Text1.Text, FindString)
            If StartPos > 0 Then
                    Text1.SelStart = StartPos - 1
                    Text1.SelLength = Len(FindString)
                    Text1.SelText = "" + ReplaceText
            End If
    Next
november_pooh commented: Yes. This code very helpful. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

You can use SysInfo Component to get information about battery status.
Project->Component->Microsoft SysInfo Control
Add it to Form and use this following codes :

Private Sub Form_Load()
    List1.AddItem "BatteryFullTime = " & _
    Format$(SysInfo1.BatteryFullTime)
    List1.AddItem "BatteryLifeTime = " & _
    Format$(SysInfo1.BatteryLifeTime)
    List1.AddItem "BatteryLifePercent = " & _
    Format$(SysInfo1.BatteryLifePercent / 100, _
    "Percent")
    Select Case SysInfo1.BatteryStatus
    Case 1
    List1.AddItem "BatteryStatus = HIGH"
    Case 2
    List1.AddItem "BatteryStatus = LOW"
    Case 4
    List1.AddItem "BatteryStatus = CRITICAL"
    Case 128
    List1.AddItem "BatteryStatus = NO BATTERY"
    Case 255
    List1.AddItem "BatteryStatus = UNKNOWN"
    End Select
End Sub
debasisdas commented: really appreceate that. +13
Sawamura commented: Thank you sir. This code working so well. I really appreciated this +3
Estella commented: I appreciated it too :) +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Option Explicit

#If Win32 Then
    Private Const LB_FINDSTRING = &H18F
    Private Declare Function SendMessage Lib _
                    "User32" Alias "SendMessageA" (ByVal _
                    hWnd As Long, ByVal wMsg As Long, _
                    ByVal wParam As Long, lParam As Any) _
                    As Long

#Else

    Private Const WM_USER = &H400
    Private Const LB_FINDSTRING = (WM_USER + 16)
    Private Declare Function SendMessage Lib _
                    "User" (ByVal hWnd As Integer, ByVal _
                    wMsg As Integer, ByVal wParam As _
                    Integer, lParam As Any) As Long
#End If

Private Sub Form_Load()
    List1.AddItem "Orange"
    List1.AddItem "Banana"
    List1.AddItem "Apple"
    List1.AddItem "Pear"
End Sub

Private Sub Text1_Change()
    Dim pos As Long
    List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, ByVal CStr(Text1.Text))

    If List1.ListIndex = -1 Then
        pos = Text1.SelStart
    Else
        pos = Text1.SelStart
        Text1.Text = List1
        Text1.SelStart = pos
        Text1.SelLength = Len(Text1.Text) - pos
    End If

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    On Error Resume Next
    If KeyCode = 8 Then 'Backspace
        If Text1.SelLength <> 0 Then
            Text1.Text = Mid$(Text1, 1, Text1.SelStart - 1)
            KeyCode = 0
        End If
    ElseIf KeyCode = 46 Then 'Del
        If Text1.SelLength <> 0 And _
            Text1.SelStart <> 0 Then
            Text1.Text = ""
            KeyCode = 0
        End If
    End If
End Sub
ITKnight commented: Thank you Jx_man for wonderful codes +2
makiprabakaran commented: sir onr dought me. when i wrongly selected do backspace bar buuton tottaly erase.i want erase one by one backspace +0
Jx_Man 987 Nearly a Senior Poster Featured Poster

did you already convert it to date format?

FormatDateTime(tanggalbaliktxt.Text, DateFormat.ShortDate)
Jx_Man 987 Nearly a Senior Poster Featured Poster

I suggest to trap it when user input the characters.
So, users can only input the specific characters.
Example : (This text box only accept numbers input only)

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

See this "tanggalpinjam.Text and tanggalbaliktxt.Text"
I think this the problem. You want to insert a date of borrowed date n returning date but you insert it as text.
Just convert it to date format. Make sure the type of both column is date in your database not text or numeric.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Each time I enter the text in the box after clicking the (Add button), it does not add it in the combobox. What's missing??

You code never add text to combo box.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim userMsg As String
        userMsg = Microsoft.VisualBasic.InputBox("Enter New City", "New City", "", 500, 500)
        ComboBox1.Items.Add(userMsg)
    End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Just use looping.
If you already manage to move single item, then use looping to move all items.

Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't understand what the relevance about your question and your posting code, but i still to answer it.

If you want to close all form and end the program then you can use END .
Unload Me just close the current form not the entire program. So any hidden form can still running.

Private Sub Command1_Click()
Unload Me
End Sub

When you use End Statement it will close all entire form, Hidden or not hidden. so any process will turning off.

Private Sub Command2_Click()
End
End Sub
Sawamura commented: I think.. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim i As Integer
If ListView1.SelectedItems.Count = 0 Then Exit Sub 
i = Val(ListView1.SelectedIndices.Item(0).ToString)
MsgBox(ListView1.Items(i).SubItems(1).Text)
End Sub

You also can use this line of code to get selected index :

i = Val(ListView1.SelectedItems(0).Index)
'and this
i = ListView1.SelectedIndices(0)
dnk commented: Your helping make this thread solved after 2 years :D +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Good. I Really appreciate when you make some effort.
You made mistake when put "next i". You just need to update the recordset.
You don't have to update data field of datareport. When you assign DataReport source with Recordset it will accommodate all data of listview on recordset.
So, it should be like this :

Dim RsTest As Recordset
Dim i As Integer
Set RsTest = New ADODB.Recordset
 
With RsTest.Fields
.Append "Field1", adDouble
.Append "Field2", adBSTR
.Append "Field3", adInteger
End With
 
RsTest.Open

For i = 1 To MyList.ListItems.Count
    With rsTest
        .AddNew
        .Fields("Field1") = MyList.ListItems(i).Text
        .Fields("Field2") = MyList.ListItems(i).SubItems(1)
        .Fields("Field3") = MyList.ListItems(i).SubItems(2)
        .Update
    End With
Next i ' Put here

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
Jx_Man 987 Nearly a Senior Poster Featured Poster

please dont mind ..I am in trouble . i am new in this field please dont pay tension on my minute questions.
I read it buti think there is rsTest which related to database. Can u sent me total Button code. Which transfer data of List view to Data report?

yes i read this code.you are right. there is no database involved.Please send me example where can i put data on datareport from ListView.

If you already read it then Make some effort.
I was give you a sample code now your turn to modified it as you needed.
Use looping to get data from listview and update recordset for each row.
Recordset will receive all data from listview.
Set datareport source to recordset then show it to data report.
Just it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

But i dont want to use any database.

Did u read this code correctly?
This code didn't use any database.
Are you trying this code?

My problem is to transfer data of Listview and textboxs (list on any form of VB6 Application ) directly to Database.

I already give you this sample code, now your turn to modified it with listview items data.

Please help me as soon as possible.

Do not expect this. You not pay me to get this code.

november_pooh commented: He the lazy one..don't get mad for him. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See If This Helps :

An example of writing a file:
Dim sFileText as String
Dim iFileNo as Integer
iFileNo = FreeFile
'open the file for writing
Open "D:\Test.txt" For Output As #iFileNo
'please note, if this file already exists it will be overwritten!

'write some example text to the file
Print #iFileNo, "first line of text"
Print #iFileNo, " second line of text"
Print #iFileNo, "" 'blank line
Print #iFileNo, "some more text!"

'close the file (if you dont do this, you wont be able to open it again!)
Close #iFileNo
Sturdy commented: Really a Vig Help +1
Estella commented: Nice :D +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

See this thread

Jx_Man 987 Nearly a Senior Poster Featured Poster

This an example :
Modified as u needed.

Set rsTest = New ADODB.Recordset

With rsTest.Fields
.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
dnk commented: Great Code +2
ITKnight commented: I even never think about this way..it's awesome dude. +2
Jx_Man 987 Nearly a Senior Poster Featured Poster
if (count<max) and (br.checked=true or am.checked=true) then
'code
end if

Yes, you can do this.

ninjatalon commented: thanks +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Did you visit the site?
There are code for printing and sample code too.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Check your Timer Enable Properties.
Make sure that is set to True, also check for Timer Interval is not 0.

Jx_Man 987 Nearly a Senior Poster Featured Poster
dnk commented: Surely great site finding.. +2
Naruse commented: Good reference +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :
Text1 is filled by any text or words
Text2 is filled by char to find.

Private Sub Command1_Click()
    Dim CharCount, i As Integer
    CharCount = 0
    For i = 0 To Len(Text1.Text)
        Text1.SetFocus
        Text1.SelStart = i
        Text1.SelLength = 1
        If Text1.SelText = Text2.Text Then 
            CharCount = CharCount + 1 sesuai
        End If
    Next
    MsgBox "You have " & CharCount & " Character " & Text2.Text
End Sub
dnk commented: Good job +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

Change with this :

My.Computer.Audio.Play(Application.StartupPath & "\beep-2.wav")
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Application.StartupPath
Jx_Man 987 Nearly a Senior Poster Featured Poster

Use Left() function.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Or you can use Left() function to get it.

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :
Assuming that the ListView already have a header, so index i start from 1.
If you don't have header then index start from 0.

Private Sub Command1_Click()
Dim temp As Integer
temp = 0
For i = 1 To ListView1.ListItems.Count
    'temp = temp + Val(ListView1.ListItems.Item(i).Text) ' First Column
    temp = temp + Val(ListView1.ListItems(i).SubItems(1)) ' Second Column 
    'temp = temp + Val(ListView1.ListItems(i).SubItems(2)) ' Third Column
Next i
MsgBox temp
End Sub
Jade_me commented: Thank You for always helping..i hope you can help me on another thread.. :D +2
november_pooh commented: Great help :) +3
Vega_Knight commented: Very helping person +2
Sawamura commented: Good. +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Please make new thread for different question.
It will help another members if they have same problem like you.
Also other members can help to answer you question if you have specific thread.
If this thread already done than please mark as solved.

Thank you.

Jx_Man 987 Nearly a Senior Poster Featured Poster

so what the result of your codes above?
any errors?
in which sub item of listview that you want to sum the items?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Okay.
And if this thread already done then please mark it as solved.
Thank you.

Jx_Man 987 Nearly a Senior Poster Featured Poster

What is the best thing to do if i have millions of data.please help me sir

Don't display the entire data but display it separately.
You can use navigate button..
I recommended you to make a new spesific thread to asking about displaying a millions data. There are many members will give a good answer.

Jx_Man 987 Nearly a Senior Poster Featured Poster

My question is that, is this code safe for millions of data and then loading it in my listview.

I think the code is safe.
But it consume many times to load a millions data.
I think its not good to displaying all entire data in one time.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Change combo box Event from Combo1_Change() to Combo1_Click() :

Private Sub Combo1_Click()
Select Case Me.Combo1
    Case "bob"
        Me.Combo2.Enabled = True
    Case "carol"
        Me.Combo2.Enabled = True
    Case "jeff"
        Me.Combo2.Enabled = False
    Case "freeda"
        Me.Combo2.Enabled = False
    Case Else ' this for case else
        Me.Combo2.Enabled = False
End Select
End Sub