Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. There is no row at position 1.

There is no row at position 1.

Scheduled Pinned Locked Moved Visual Studio
helpdatabaseannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 7876168
    wrote on last edited by
    #1

    ok, I have a datagridview and in that a delete row button. When I click the delete button when there is no data, the program crashes. Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick If e.ColumnIndex <> 7 Then Exit Sub End If VoicemailDataSet.Message.Rows(DataGridView1.CurrentRow.Index).Delete() THE ERROR COMES IN HERE MessageTableAdapter.Update(VoicemailDataSet.Message) End Sub What I need is if someone decides to push the delete button despite the fact there is no information that the program does not crash. In essence I just really need some help with error handling. Thanks!

    L T 2 Replies Last reply
    0
    • U User 7876168

      ok, I have a datagridview and in that a delete row button. When I click the delete button when there is no data, the program crashes. Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick If e.ColumnIndex <> 7 Then Exit Sub End If VoicemailDataSet.Message.Rows(DataGridView1.CurrentRow.Index).Delete() THE ERROR COMES IN HERE MessageTableAdapter.Update(VoicemailDataSet.Message) End Sub What I need is if someone decides to push the delete button despite the fact there is no information that the program does not crash. In essence I just really need some help with error handling. Thanks!

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      This is not a Visual Studio issue, please post in the forum appropriate to the language you are using: looks to me like VB.

      Unrequited desire is character building. OriginalGriff

      1 Reply Last reply
      0
      • U User 7876168

        ok, I have a datagridview and in that a delete row button. When I click the delete button when there is no data, the program crashes. Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick If e.ColumnIndex <> 7 Then Exit Sub End If VoicemailDataSet.Message.Rows(DataGridView1.CurrentRow.Index).Delete() THE ERROR COMES IN HERE MessageTableAdapter.Update(VoicemailDataSet.Message) End Sub What I need is if someone decides to push the delete button despite the fact there is no information that the program does not crash. In essence I just really need some help with error handling. Thanks!

        T Offline
        T Offline
        tgurlevik
        wrote on last edited by
        #3

        you can use if statement.

        if(DataGridView1.Rows.Count!=0){
        VoicemailDataSet.Message.Rows(DataGridView1.CurrentRow.Index).Delete();
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups