Problem in list view function..

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

31 Replies - 808 Views - Last Post: 24 February 2012 - 06:42 PM Rate Topic: -----

#16 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 07:03 AM

OK if that isn't working then
1. Either there is not exact match on item.Text & lblEmpNo.Text or SubItem2 is not ""

Have you stepped through the code with the debugger to see if your line inside the if block is being executed?

Here's a simple way of seeing if that is being done.
For Each item As ListViewItem In ListView1.Items
    If item.Text = lblempno.Text And item.SubItems(2).Text = "" Then
       MessageBox.Show("I found the item") 'Remove this when testing is done.
       item.SubItems(2).Text = lbltime.Text
    End If
Next

Now when you run the code, if you don't get the messagebox then one of your checks isn't true and it's skipping over the setting of Item.SubItems(2).Text.
Was This Post Helpful? 1
  • +
  • -

#17 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 08:03 AM

the msgbox didn't show after i CLOCKED OUT. :(

this is my index

for name = 0
for clock in = 1
for clock out = 2

This post has been edited by bry090911: 24 February 2012 - 10:26 AM

Was This Post Helpful? 0
  • +
  • -

#18 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 08:33 AM

So they don't match both results. Now which one doesn't match?

So give me EXACTLY (Case and everthing) what is displayed in lblempno.Text right before this for each runs.

Also a screenshot of your listview
Was This Post Helpful? 0
  • +
  • -

#19 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 08:45 AM

When i CLOCK IN....[and it is successful]
Posted Image

When i CLOCK OUT....[and it is successfull]
Posted Image

then nothings happen...
Posted Image

This post has been edited by bry090911: 24 February 2012 - 10:25 AM

Was This Post Helpful? 0
  • +
  • -

#20 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 08:49 AM

OH OK, so subitem(2).Text is not "" you have something in it. Why don't you check to make sure that it contains what you put there when you clocked in.

This post has been edited by CharlieMay: 24 February 2012 - 08:50 AM

Was This Post Helpful? 0
  • +
  • -

#21 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 09:04 AM

i can give you my application, so you can understand. thanks for helping me bro. I appreciate all. wait i`ll upload my application. :)
Was This Post Helpful? 0
  • +
  • -

#22 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 09:07 AM

huh? No, you don't need to send it, you need to look at what you have in the listview. and what you're trying to find.

When you clockin you have
09099...11:40 AM...OUT

So what is in the.Text of the listview?

What is in subitem(2).Text of the listview?

If you want to find that exact item what would you search for with your IF statement

If item.Text = "what" AND item.SubItems(2).Text = "what"

what would you have to put there to find the item I listed above?

This post has been edited by CharlieMay: 24 February 2012 - 09:07 AM

Was This Post Helpful? 0
  • +
  • -

#23 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 09:11 AM

this is the what i am working on.

This post has been edited by bry090911: 24 February 2012 - 06:38 PM

Was This Post Helpful? 0
  • +
  • -

#24 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 09:15 AM

Click Here

This is what you need to do :P
Was This Post Helpful? 0
  • +
  • -

#25 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 09:15 AM

it is 'OUT' but if i click the CLOCK OUT and then when i check the database it is okay. the only problem is the listview not on the database.


0 for Employee number
1 for time in
2 for time out
Was This Post Helpful? 0
  • +
  • -

#26 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 09:22 AM

hmmm. So you put the record in the database and now you want to put it in the listview.

So why are we concerned with the database at this moment when all we want to do is update the listview?

To update the listview answer the questions I asked in post 22 and you'll answer your own question.
Was This Post Helpful? 0
  • +
  • -

#27 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 09:28 AM

So what is in the .Text of the listview? 'OUT'

What is in subitem(2).Text of the listview? 'CLOCK OUT'

If you want to find that exact item what would you search for with your IF statement? the employee number

If item.Text = "what" AND item.SubItems(2).Text = "what"
item.text = lblempno.text and item.subitems(2).text = ""

what would you have to put there to find the item I listed above?

This post has been edited by bry090911: 24 February 2012 - 09:29 AM

Was This Post Helpful? 0
  • +
  • -

#28 CharlieMay  Icon User is online

  • This space intentionally left blank
  • member icon

Reputation: 1382
  • View blog
  • Posts: 4,458
  • Joined: 25-September 09

Re: Problem in list view function..

Posted 24 February 2012 - 09:36 AM

NO

09099 is what is in the item.Text field (that is what you're passing with lblempno.text) That is fine.

In subitem(2) it says OUT

So subitem(2) is NOT "" it is "OUT" that is why you are never finding a match

If item.text = lblempno.text AND item.subitems(2).Text = "OUT" then

This is the only way it is going to find that line.
You are looking in the listview NOT the database.

You HAVE to match what you're searching and since you put "OUT" in the clockout field during clockin, the ONLY way you're going to find it with those conditions is find the one that has the employee number and OUT in the clockout column OF THE LISTVIEW!!!!
Was This Post Helpful? 1
  • +
  • -

#29 bry090911  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 112
  • Joined: 02-February 12

Re: Problem in list view function..

Posted 24 February 2012 - 09:51 AM

Posted Image


He find the item BUT he listed it in the last row. :( :(

i put my employee number '09099' then that is the output.

This post has been edited by bry090911: 24 February 2012 - 10:01 AM

Was This Post Helpful? 0
  • +
  • -

#30 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 1951
  • View blog
  • Posts: 8,680
  • Joined: 29-May 08

Re: Problem in list view function..

Posted 24 February 2012 - 10:16 AM

Why are you even creating a GUI, at this stage of development?

From my reading of this thread indications you haven't thought about the design before begin to start coding.
Where the data encapsulation? Or is everything control - based.

My thoughts:- GUI first leads to Stinky Code.

Stop now, and think about the encapsulations and abstractions.
GUI are for Input and Output Only. Command and Control is handled by your business object. Imagine there's no GUI just simple objects. How am I going design those Objects to accomplish my goal? How can I inform observers there been a change?

What are your business object?
I see at least three;- Employee , TimeCard, ClockingSystem
Was This Post Helpful? 0
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3