PDA

View Full Version : چگونه آیتم های مختلف dataGridView را انتخاب نماییم ؟



dele_ghamgin_2008
سه شنبه 05 فروردین 1393, 00:18 صبح
من یک dataGridView دارم که با زدن دکمه ی باتن یک سری اطلاعات درونش مقدار دهی می شود . حال می خواهم وقتی روی یک باتن کلیک می کنم ، ردیف بعدی را انتخاب کند . و با کلیک مجدد روی باتن به ردیف بعدی برود . یعنی با هر بار کلیک روی باتن ، ردیف بعدی از آیتم dataGridView را انتخاب کند. لطفاً راهنمایی فرمایید .

dele_ghamgin_2008
سه شنبه 05 فروردین 1393, 01:10 صبح
خواهشا یک نفر پاسخ دهد.

behnam-soft
سه شنبه 05 فروردین 1393, 10:32 صبح
باید دیتا گریدت رو بایند کنی به کنترل Binding Navigator، فکر می کنم مشکلت اینطوری برطرف میشه.

dele_ghamgin_2008
سه شنبه 05 فروردین 1393, 11:45 صبح
باید دیتا گریدت رو بایند کنی به کنترل Binding Navigator، فکر می کنم مشکلت اینطوری برطرف میشه.

میشه لطفاً کدش رو به من بدهید ؟ چون من از چیزی که گفتید سر در نیاوردم . ممنونم .

zayens
سه شنبه 05 فروردین 1393, 12:27 عصر
dgv1.CurrentCell = dgv1.Rows[dgv1.CurrentRow.Index + 1].Cells[1];

dele_ghamgin_2008
سه شنبه 05 فروردین 1393, 17:14 عصر
dgv1.CurrentCell = dgv1.Rows[dgv1.CurrentRow.Index + 1].Cells[1];

dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index + 1].Cells[1];
برنامه خطا داد در هنگام اجراش :

System.InvalidOperationException was unhandled
Message=Current cell cannot be set to an invisible cell.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.DataGridView.set_CurrentCell( DataGridViewCell value)
at RssReaderWinForm.Form1.btnNext_Click(Object sender, EventArgs e) in E:\Spamer\Aradrobo.org\RssReaderWinForm\RssReaderW inForm\Form1.cs:line 272
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at RssReaderWinForm.Program.Main() in E:\Spamer\Aradrobo.org\RssReaderWinForm\RssReaderW inForm\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

dele_ghamgin_2008
سه شنبه 05 فروردین 1393, 17:35 عصر
dgv1.CurrentCell = dgv1.Rows[dgv1.CurrentRow.Index + 1].Cells[1];

مقدار درون cell را برابر صفر کردم مشکل حل شد . مرسی دوست عزیز. :قلب: