Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6728749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:12:26+00:00 2026-05-26T10:12:26+00:00

The error occurs on the line If wba.Selected = MARKETING CODE Then … Hopefully

  • 0

The error occurs on the line If wba.Selected = "MARKETING CODE" Then … Hopefully someone might be able to help. Thanks

'Private Sub NewRecord_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    markCodes = New DataGridViewComboBoxColumn()
    markCodes.Name = "Marketing Codes"
    Me.DataGridView1.Columns.Add(markCodes)
    markCodes.Visible = False
End Sub

'Private Sub DataGridView1_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs)

    If DataGridView1.CurrentCell.ColumnIndex = DataGridView1.Columns(wba.Name).Index Then
        If TypeOf e.Control Is ComboBox Then
            cbxWba = TryCast(e.Control, ComboBox)
            RemoveHandler cbxWba.SelectionChangeCommitted, New EventHandler(AddressOf cbxWba_SelectionChangeCommitted)
            AddHandler cbxWba.SelectionChangeCommitted, New EventHandler(AddressOf cbxWba_SelectionChangeCommitted) 'this event will fire up if there's a selected item.
        End If
    End If

End Sub

'Private Sub cbxWba_SelectionChangeCommitted(ByVal sender As Object, ByVal e As EventArgs)

    loadDescriptions()

End Sub

Private Sub loadDescriptions()

    If wba.Selected = "MARKETING CODE" Then

        markCodes.Visible = True
        Try
            Dim con As New SqlConnection
            con.ConnectionString = ""
            Dim myCommand1 As New SqlClient.SqlCommand
            Dim myAdapter1 As New SqlClient.SqlDataAdapter
            Dim sql As String = "Select analysis_a + ' - ' + [desc] as Expr1 from marketingCode"
            Dim ds As New DataSet
            myCommand1.Connection = con
            myCommand1.CommandText = sql
            myAdapter1.SelectCommand = myCommand1
            myCommand1.Connection.Open()
            myAdapter1.Fill(ds)
            myCommand1.Connection.Close()
            Dim dt As New DataTable
            dt = ds.Tables(0)


            For Each row As DataRow In ds.Tables(0).Rows
                DataGridView1.CurrentRow.Cells(description.Name).Value = row("Expr1").ToString()
                markCodes.DataSource = dt
                markCodes.DisplayMember = "Expr1"
                markCodes.ValueMember = "Expr1"
            Next


        Catch
            MsgBox("failed")
        End Try

    End If



End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:12:27+00:00Added an answer on May 26, 2026 at 10:12 am

    What is wba? The .Selected sounds like you are comparing a boolean property to an string.

    Looking at your code, I assume that wba is a datagridviewrow, and then you cant use .Selected in that way.
    To check for a value of the first selected cell in the datagridview:

            With DataGridView1
                If .SelectedCells.Count > 0 Then
                    If .SelectedCells(0).Value = "MARKETING CODE" Then
                        'we have a hit
                    End If
                End If
            End With
    

    or, if you allready know what cell it is and has stored the selected cell in the wba-variable:

                    If wba.Value = "MARKETING CODE" Then
                        'we have a hit
                    End If
    

    If you have selectionmode=fullrowselect and want to check if first cell in the first selected datagridviewrow has a value:

            With DataGridView1
                If .SelectedRows.Count > 0 Then
                    If .SelectedRows(0).Cells(0).Value = "MARKETING CODE" Then
                        'we have a hit
                    End If
                End If
            End With
    

    If you have the row stored in the wba, and want to check if the first cell in that row has a specific value then its like this:

            If wba.Cells(0).Value = "MARKETING CODE" Then
                'we have a hit
            End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I write this code: On running, an error occurs in the line cout<<it2->first; Unhandled
This error occurs in setContentView line in this code snippet: /** Called when the
My error occurs on line 191 and 156. For some reason it is saying
Error occurs on this line: xPoint is Int32 randomsize is int xPoint = pictureBox1.Width
The error occurs on line 65: } catch (Exception $e){ <?php require includes/connect.php; function
The error occurs when I try to do this friend std::ostream& operator<<(std::ostream& os, const
When an error occurs in a function, I'd like to know the sequence of
The following error occurs in make, while trying to do incremental builds: make[2]: execvp:
What causes the publish error: fl.getDocumentDOM() has no properties ? The error occurs only
I want to make sure that if any error occurs during the database processing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.