Click here to Skip to main content
15,898,795 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: how to create control array ? in vb .net Pin
TwoFaced9-Jul-07 19:51
TwoFaced9-Jul-07 19:51 
QuestionMe.ActiveControl.Name does not display any name Pin
babusat9-Jul-07 23:30
babusat9-Jul-07 23:30 
AnswerRe: Me.ActiveControl.Name does not display any name Pin
TwoFaced10-Jul-07 5:18
TwoFaced10-Jul-07 5:18 
QuestionSort the data in a DataGrid Pin
atlasliu8-Jul-07 17:38
atlasliu8-Jul-07 17:38 
AnswerRe: Sort the data in a DataGrid Pin
Rupesh Kumar Swami8-Jul-07 19:25
Rupesh Kumar Swami8-Jul-07 19:25 
QuestionHow to get "ID" from a DataGrid? Pin
atlasliu8-Jul-07 17:36
atlasliu8-Jul-07 17:36 
AnswerRe: How to get "ID" from a DataGrid? Pin
Tom Deketelaere8-Jul-07 21:47
professionalTom Deketelaere8-Jul-07 21:47 
Questionhow do I disable buttons if first row selected in DataGridView? Pin
matt_in_oz8-Jul-07 17:33
matt_in_oz8-Jul-07 17:33 
Hi all,

I want be able to enable and disable navigation buttons when on the first or
last row of a DataGridView object.

I have a populated DataGridView and two buttons - "First Row" and "Previous Row"
If the user clicks "First Row", they are taken to the first row in the DataGridView via:

Private Sub btnFirstRecord_Click(...) <br />
   ' Move to first record in job list <br />
   dgvMyRecords.CurrentCell = dgvMyRecords.Rows(0).Cells(0)<br />
End Sub

What I then want to to is disable the Prev Row button like this...

Private Sub dgvMyRecords_SelectionChanged(...)<br />
   If dgvMyRecords.CurrentRow.Index = 0 Then <br />
      btnPrevRow.Enabled = False<br />
   Else <br />
      btnPrevRow.Enabled = True <br />
   End if <br />
End Sub


The problem is... this works if the user selects the first record using the mouse,
but not if the first record is selected through the code using CurrentCell.

If I click on the first row, SelectionChanged gets called AFTER the row gets changed.
If I set dgvMyRecords.CurrentCell to dgvMyRecords.Rows(0).Cells(0) (ie. select the first
row via code), SelectionChanged gets called, but BEFORE the row gets changed !?!?!? Confused | :confused:

Can anyone show me how to do this ?

cheers,
Matt.
AnswerRe: how do I disable buttons if first row selected in DataGridView? Pin
Thomas Chester9-Jul-07 8:25
Thomas Chester9-Jul-07 8:25 
GeneralRe: how do I disable buttons if first row selected in DataGridView? Pin
matt_in_oz9-Jul-07 17:21
matt_in_oz9-Jul-07 17:21 
QuestionAbsolutely Desperate...MAPI anyone Pin
EvScott8-Jul-07 9:08
EvScott8-Jul-07 9:08 
AnswerRe: Absolutely Desperate...MAPI anyone Pin
The ANZAC8-Jul-07 17:14
The ANZAC8-Jul-07 17:14 
GeneralRe: Absolutely Desperate...MAPI anyone Pin
EvScott9-Jul-07 3:59
EvScott9-Jul-07 3:59 
QuestionApproximation Pin
magedhv8-Jul-07 0:03
magedhv8-Jul-07 0:03 
AnswerRe: Approximation Pin
Luc Pattyn8-Jul-07 0:09
sitebuilderLuc Pattyn8-Jul-07 0:09 
GeneralRe: Approximation Pin
magedhv8-Jul-07 0:49
magedhv8-Jul-07 0:49 
GeneralRe: Approximation Pin
Luc Pattyn8-Jul-07 1:33
sitebuilderLuc Pattyn8-Jul-07 1:33 
AnswerRe: Approximation Pin
Christian Graus8-Jul-07 7:00
protectorChristian Graus8-Jul-07 7:00 
Questiondata gride view Pin
magedhv7-Jul-07 22:41
magedhv7-Jul-07 22:41 
QuestionHow to make a particular item of datagrid uneditable? Pin
hsprasain7-Jul-07 18:47
hsprasain7-Jul-07 18:47 
QuestionRunning an app/process withing my vb.net app Pin
y2ktheory7-Jul-07 15:17
y2ktheory7-Jul-07 15:17 
AnswerRe: Running an app/process withing my vb.net app Pin
Christian Graus7-Jul-07 15:48
protectorChristian Graus7-Jul-07 15:48 
GeneralRe: Running an app/process withing my vb.net app Pin
y2ktheory7-Jul-07 16:20
y2ktheory7-Jul-07 16:20 
GeneralRe: Running an app/process withing my vb.net app Pin
Christian Graus7-Jul-07 16:40
protectorChristian Graus7-Jul-07 16:40 
GeneralRe: Running an app/process withing my vb.net app Pin
y2ktheory7-Jul-07 16:52
y2ktheory7-Jul-07 16:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.