i am trying to save values in a textbox for each item in a list of items. The textbox will prompt for values and a button(btnTag) saves the value to the item in a list.

The code below saves the value of the textbox for all the items in the list, but i want it saved individually

Dim counter As Integer
        For counter = NextPhotoNumber To PhotostoView.Count
            blockOfText = txtTag.Text
        Next

        If Len(txtTag.Text) = 0 Then
            MsgBox("Invalid Number Format", MsgBoxStyle.OkOnly)

            txtTag.Text = blockOfText
            lblStatus.Visible = False

        End If
        Me.NextPhotoNumber += 1
        images.tagging()
        Me.DisplayImage()
        btnNext.Enabled = True
        btnPrevious.Enabled = True
        txtTag.Clear()
        txtTag.Select()

thanks

Recommended Answers

All 8 Replies

I didn't understand your question. You need user to type in textbox then press on button, which will take textbox text and add it to list?

I am designing a picture identification application. When pictures have been uploaded, then i want to tag each of the pictures in list. As they appear via a NEXt button using one textbx

On button click event handler

YourList.Items.Add(TextBox.Text)

I am designing a picture identification application. When pictures have been uploaded, then i want to tag each of the pictures in list. As they appear via a NEXt button using one textbx

i guess you should create a unique "ID" for each picture so that it is easy for you to find/manipulate.

thanks guys

If it solved please mark it as solved. Otherwise tell us any problem you face.

there was an error, the first two pictures were successfully tagged but the third it said.
Item has already been added. Key in dictionary: 'untagged' Key being added: 'untagged'

this is my current code

txtTag.Text = blockOfText

        If Len(txtTag.Text) = 0 Then
            MsgBox("     Image not tagged ", MsgBoxStyle.Exclamation)
            blockOfText = "untagged"

        Else
            txtTag.Text = blockOfText
            lblStatus.Visible = False
        End If
        Me.PhotostoView.Add(txtTag.Text)

Because you add in your dictionary two keys with the same name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.