Jx_Man 987 Nearly a Senior Poster Featured Poster
If Me.PASSWORD.Value = DLookup("password", "tblEmployees", "[username]=" & Me.Combo0.Value) Then
Jx_Man 987 Nearly a Senior Poster Featured Poster

Why not use StrConv()

See if this helps :

Private Sub txtQuote_Change()
  txtQuote.Text = StrConv(txtQuote.Text, vbProperCase)
  txtQuote.SelStart = Len(txtQuote.Text)
End Sub
dnk commented: Very Quckly Response +2
Jade_me commented: :D +2
Naruse commented: Agree +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

hye jan plz explain how can i use Listview? In my project.?

Project -> Component (Ctrl + T)
looking for "Microsoft Windows Common Controls 6.0 (SP6)" and check it.
you can find listview on your toolbox.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hello sir, Yes i want to add new data sir,how could it be sir?

Really, I hope you understand what i mean.

Okay, if you want to add a new data.
Just check if the checkbox is checked then add data with status is Active and if checkbox not checked then add data with status is Not Active.

Private Sub cmdadd_Click()
Dim CheckTemp As String

If chkbox.Value = 1 Then
    CheckTemp = "Active"
Else
    CheckTemp = "Not Active"
End If

sql = "INSERT INTO Customer(Id,User_Name,Family_Name,Status) VALUES('" & txtid.Text & "','" & txtname.Text & "', '" & txtfname.Text & "','" & CheckTemp & "')"
con.Execute (sql)

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi,
You make this thread Unsolved and you ask the different question now..
Please keep the originally question of this thread about how to transfer data from flexgrid.
Also, you already have a new thread about your question.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Listview i think..

Jx_Man 987 Nearly a Senior Poster Featured Poster

you mean to change textbox font type?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hello sir, Thank you for the reply.I Forgot to put the field.The name of the field in my database is Status,and i want it Active or Not Active.

So i can conclude that you have Id,User_Name,Family_Name and Status on your customer table.

This following quote is your example on your first post :

Jemz Gimz 123 then i will check the checkbox and click the Add button
it should display on my listview
Jemz Gimz 123 Active.

In your example you looks like you want to update/edit current data on the table not to add new data on the table.
So my next question is you want to add fresh data or you want to update/edit a current data on the customer table?

Jx_Man 987 Nearly a Senior Poster Featured Poster

i don't understand correctly.
You want to add it (active or not active) to database or just for temporary only?
Do you have a field for it on database?

Jx_Man 987 Nearly a Senior Poster Featured Poster

how can i add a time (hour,minute or second) in a current time?

Try this :

Label1.Caption = Format(Now, "hh:mm:ss") ' display current time on label
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hello sir thank you for the reply.Okay sir i will marked this solved.I apologize.I will make my new thread.

Thank you :)
Happy coding.

Jx_Man 987 Nearly a Senior Poster Featured Poster

what exactly do you want here??
how far you doing this?

Jx_Man 987 Nearly a Senior Poster Featured Poster

This following code to get data from datagrid..

DataGrid1.Row = 0 ' first row.. just looping as many of datagrid rows 
DataGrid1.Columns(0).Value
DataGrid1.Columns(1).Value
DataGrid1.Columns(2).Value
Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi guys, basically im writing a program where the user inputs the number of coffees they require from a number of drop down boxes, one for cappucino, espresso, iced coffee and latte. after this, there is a 'calculate' button which totals these up and displays them in a textbox.

my problem is (mostly cos im a vb novice) is that i also need to be able to count up the number of coffees selected over the use of the program, and to be able to average them out. these need to be displayed in a text box an another form.

basically so far, i have created variables in the drop down boxes.
anslatt = Val(Combolatt.Text) * 1.85 etc.

then added these up
bftakeaway = anscapp + ansespr + ansiced + anslatt
AnswerBox1.Text = bftakeaway


simple i know, but its the best i could do haha!

anyway thanks so much for reading and any help would be really appreciated!

How about post your code that you've been work so far..so we can understand more..also post more information..

Jx_Man 987 Nearly a Senior Poster Featured Poster

i am able to add items in listview at runtime ,but not able to add this items and subitems in database pls help me in code

Use looping to read items and subitems from listview and add each of it to database.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Lets keep originally question of this thread. if this thread already answered please make it solved and if you have a new question please make a new thread. it will help another member when they search a same thread.

Thank you :)

For your question :

can you help me please how can i make the higlight remain if i will set the cursor to the textfield.

Set the HideSelection property of the ListView control to false..

Jx_Man 987 Nearly a Senior Poster Featured Poster

I don't understand correctly what do you want here.
You mean to add data into table of database?
if i right then use Insert statment to add data.
Datagrid is using for display data on database.

Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome.
Happy Coding :)

Jx_Man 987 Nearly a Senior Poster Featured Poster
MsgBox temp(0) + vbCrLf + temp(1) + vbCrLf + temp(2) + vbCrLf + temp(3)

You accessing array with this way..
How about if you have many words separated with commas?
Are you want to get all data by write it one by one?
Use looping and Ubound to get last index of array

Private Sub Command1_Click()
Dim temp As Variant
Dim str As String
Dim arr As String
str = "i,love,you,forever"
temp = Split(str, ",")

For i = 0 To UBound(temp) ' get the last index with Ubound
    arr = arr + temp(i) + vbCrLf ' Read data until last index and store it on arr
Next i
MsgBox arr ' display it on message box
End Sub
Naruse commented: You enlighten me so much sir..Thank you :) +3
dnk commented: good point. +2
november_pooh commented: Good Point here.. :D +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

use split function.

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps.

Actually when you add data it added in the last.
So, you just simply select the last data on listview :

Private Sub cmdadd_Click()

sql = "INSERT INTO Customer(id,Name,familyName,Address) VALUES('" & lngId & "','" & txtname & "', '" & txtfamilyname & "','" & txtaddress & "')"
con.Execute sql
 
GetData lvwIP

' Select a newly data added start here
ListView1.ListItems(ListView1.ListItems.Count).Selected = True ' select the last data on list view and set it as true
ListView1.SetFocus ' set focus on listview
ListView1.FullRowSelect = True ' full row selected

End Sub

But if you don't sure if data not added on last index then use this following code :

Private Sub cmdadd_Click()
' Declared variable
Dim itm As ListItem 
Dim strSearch As String
Dim x As Integer
 
sql = "INSERT INTO Customer(id,Name,familyName,Address) VALUES('" & lngId & "','" & txtname & "', '" & txtfamilyname & "','" & txtaddress & "')"
con.Execute sql
 
GetData lvwIP

' Select a newly data added start here
strSearch = Text1.Text

For Each itm In ListView1.ListItems ' search for all list item on listview
    If itm.Text = strSearch Then ' assign if item = strsearch
        x = itm.Index ' get the index of founded item
        ListView1.ListItems(x).Selected = True ' Highlight the row
        ListView1.SetFocus ' set focus on listview
    End If
Next
ListView1.FullRowSelect = True ' full row selected

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Use Format function to make it right aligned.
Also change textbox font to Courier New.

Private Sub Command1_Click()
Dim GRN As Integer
With FGRID1
    For GRN = 1 To .Rows - 1
        Text6.Text = Text6.Text & vbCrLf & .TextMatrix(GRN, 0) & vbTab & _
        Format$(Format$(.TextMatrix(GRN, 2), "##0.00"), "@@@@@@@@@@@@@")

    Next i
End With
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

see this site for adOpenstatic explaination
Don't Forget to mark this thread as solved :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

You're Welcome.
Don't Forget to mark this thread as solved.
Happy Coding ;)

Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Dim i, Count As Integer

Count = 0

i = InStr(i + 1, Text1.Text, "How")
If i = 0 Then
    MsgBox 0
    Exit Sub
End If

Do While i > 0
    i = InStr(i + 1, Text1.Text, "How")
    Count = Count + 1
Loop

MsgBox Count
dnk commented: Thanks +2
ITKnight commented: Nice code +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

How far you doing this?
Post the code that you've been work.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Sorry for that, my Bad.
Declare view as list item :

Dim view As ListItem
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this following code to display data from access :

Private Sub GetData(LSV As ListView)
Call ColumnName(lvwIP, "Name", 40, "Family Name", 30, " Address", 40)
            
    Set rs = New ADODB.Recordset
    rs.Open "SELECT * from Customer", Con, adOpenStatic, adLockOptimistic
    
    LSV.ListItems.Clear
    
    While Not rs.EOF
        Set View = LSV.ListItems.Add
        View.Text = rs!Name
        View.SubItems(1) = rs!familyName
        View.SubItems(2) = rs!Address
       
        rs.MoveNext
    Wend
    rs.Close
    
End Sub

Call GetData after insert data :

Private Sub cmdadd_Click()

 Dim lngId As Long
 
 lngId = GenNextID
  

 sql = "INSERT INTO Customer(id,Name,familyName,Address) VALUES('" & lngId & "','" & txtname & "', '" & txtfamilyname & "','" & txtaddress & "')"
 con.Execute sql

GetData lvwIP ' Call here to update listview

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

You have procedure to display it..ColumnName..just call after insert data.

Private Sub cmdadd_Click()

 Dim lngId As Long
 
 lngId = GenNextID
  

 sql = "INSERT INTO Customer(id,Name,familyName,Address) VALUES('" & lngId & "','" & txtname & "', '" & txtfamilyname & "','" & txtaddress & "')"
 con.Execute sql

Call ColumnName(lvwIP, "Name", 40, "Family Name", 30, " Address", 40) ' Call here to update listview

End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

How far you doing this?
Post your code, we try to help :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

So you want to get data from grid to One Textbox only?
Post your code how far you doing this?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hello,


Please help me, how can i populate or display my newly added list in the listview, if i will click my addbutton.can you please help me.

Thank you in advance and I am hoping for your positiver response.

Hi,
Are you can display data on listview?
What database are you using?

Jx_Man 987 Nearly a Senior Poster Featured Poster

Show us your effort. how far you doing this?
Just post your code and we try to helps you.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi ashapbhalerao,,
Please create your own thread here
do not hijact another thread and rise old thread.

Thank You. :)

Jx_Man 987 Nearly a Senior Poster Featured Poster

My poor attempt thus far:

Sub FillRange()
Num = 0
For row = 1 To 10
For col = 1 To 10
Sheets("Sheet1").Cells(row, col).Value = Num
Num = Num + 1
Next col
Next row
End Sub

Any error here?
Is this your all code?

Jx_Man 987 Nearly a Senior Poster Featured Poster

is it necessary to make an array in displaying the column header in the listview?

Not necessary too. I make this code for flexibility purpose. so, you don't have to create new code for new header. just change the parameters on array when you call it. But, if you don't have many list view to set or if your headers is never change then it's not necessary to use array.
You can use this simply following code to add header without array :

With ListView1
    .View = lvwReport ' make listview looks like report view
    .ColumnHeaders.Clear ' Clear header
    .ColumnHeaders.Add , , "First Name", 2000 ' Add header name n width
    .ColumnHeaders.Add , , "Last Name", 2000 ' Add header name n width
    .ColumnHeaders.Add , , "Address", 3000 ' Add header name n width
End With

sir can i ask with you where did you get idea on this or what reference book did you use sir?

i coded this procedure when i was in college and i don't have any reference book.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Hi Zeb noon,
Please post your new question on new thread, with new title. you can get many helps from other members and gurus in new thread. i will help you there too.
Just keep the this thread for your originally question.
And Don't Forget to Mark This Thread As Solved.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Use Mid function to search space in text box:

Private Sub Command1_Click()
Dim Counts As Integer
If Text1.Text = "" Then
    Counts = 0
Else
    Counts = 1
    For i = 1 To Len(Text1.Text)
        If Mid(Text1.Text, i, 1) = " " Then ' use Mid to search space
            Counts = Counts + 1
        End If
    Next
End If
MsgBox Counts
End Sub
WaltP commented: Why do you insist on doing their homework? -3
dnk commented: Thanks for Mid function +2
november_pooh commented: Usefull +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

i need to run program when computer starts. i m trying this

Shell "schtasks /create /sc onstart/tn autoonoff/tr D:\old files\Vb Projects\Auto Shut n Restart\Project1.exe"

i m administrator but want to make this for both administrator and user. operating system where this program will run is Xp sp2

you using shell code in vb code application or in batch file?

Jx_Man 987 Nearly a Senior Poster Featured Poster

why did you use this and you use the call in the formload

I give you this code to make you more easier when you set a listview header. You can use this procedure at any event. Call used to call subroutine like procedure or function.

can you please put some comments sir so that i can understand what is the purpose for this.

Okay, I'll try to explain it.

Private Sub ColumnName(LSV As ListView, ParamArray lstview()) ' LSV declared as listview , lstview is an array to receive column name n width (see the paramaters when this procedure called in form load)
    Dim i, width
    LSV.View = lvwReport 'this will make listview looks like report view.
    width = LSV.width - 80 ' set the width
    With LSV.ColumnHeaders
        .Clear ' Clear the listview header before add headers.
        For i = 0 To UBound(lstview) - 1 Step 2 ' UBound used to get last index of an  array, step 2 is forward 2 steps (i=0,i=2,i=4,i=6...)
        .Add , , lstview(i), (lstview(i + 1) * width) / 100 ' lstview(i) is data on array at index i. lstview(i + 1) is data on array at index i + 1.
        ' Why is i + 1? cause in this looping we use step 2, so if index i is header name then index (i + 1) is header width.
        ' i=0 is header name, i=1 is header width, i=2 is header name, i=3 is header width, and so on.
        ' Call ColumnName(lvwStud, "First …
Jx_Man 987 Nearly a Senior Poster Featured Poster

If you have array textboxes then you can use looping to clear text box :

Dim i as Integer
For i = 0 to 10
    txt(i).Text = ""
Next

Or you can check if the type of control is text box then clear the control text.

For Each txt In Form1.Controls
    If TypeOf txt Is TextBox Then txt.Text = ""
Next
Sturdy commented: Really Great :) +1
debasisdas commented: agree +12
november_pooh commented: Helping +3
Jx_Man 987 Nearly a Senior Poster Featured Poster

Try This :

Option Explicit

Private Sub Form_Load()
 ConnectToDB
 Call ColumnName(lvwStud, "First Name", 40, "Last Name", 40, "Address", 70)
End Sub

Private Sub ColumnName(LSV As ListView, ParamArray lstview())
    Dim i, width
    LSV.View = lvwReport
    width = LSV.width - 80
    With LSV.ColumnHeaders
        .Clear
        For i = 0 To UBound(lstview) - 1 Step 2
        .Add , , lstview(i), (lstview(i + 1) * width) / 100
        Next i
    End With
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Set true or false.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Label1.Text = Now.Hour & ":" & Now.Minute & ":" & Now.Second
End Sub
Jx_Man 987 Nearly a Senior Poster Featured Poster

Clear it before.

ComboBox2.Items.Clear()
Jx_Man 987 Nearly a Senior Poster Featured Poster

See if this helps :

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long
Dim RetVal As Long
Private Sub Command1_Click()
Dim y As Integer
   y = MsgBox("Are u sure to delete all items on Recycle Bin ? ", vbYesNo, "Confirmation")
   If y = vbYes Then
      RetVal = SHEmptyRecycleBin(0&, vbNullString, &H1)
   MsgBox "Recycle Bin has been cleaned"
   End If
End Sub
Naruse commented: Its Worked :) +2
Jx_Man 987 Nearly a Senior Poster Featured Poster

you can use API file to do this.

Jx_Man 987 Nearly a Senior Poster Featured Poster

you didn't answer my other question.
you want insert from which combo box to what field?

Jx_Man 987 Nearly a Senior Poster Featured Poster

If done then please mark this thread as solved.

Thanks.

Jx_Man 987 Nearly a Senior Poster Featured Poster

Try this :

Private Sub Timer1_Timer()
TCount = TCount - 1

Label1.Caption = TCount  
If TCount = 0 Then
  Msgbox "Time's UP!"
End If
End Sub