datagridview

Set Culture Invariant for whole application(thread) Point '.' instead of ','

二次信任 提交于 2019-12-25 02:39:31
问题 I have this application which requires the user to introduce some prices etc. working with dataGridViews also to display. The problem is that on certain computers the '.' this is treated as ',' I managed to get some TextBox leave event to and set the Invariant Culture for it but is useless as im using dataGridViews to display and also ReportViewer I also have a code that converts numbers to text and with this problem my application is worthless in current state with this Culture problem so I

how to pull data from DB/datagridview/datatable

試著忘記壹切 提交于 2019-12-25 02:13:07
问题 I have this table.. and I want to pull a specific data.. Let's say.. I have Home Depot as a button. how can I pull the CameraID value of 2 and put it on a variable.. something like this.. 'dim foo as string = cameraID where MarkerName is Home Depot 回答1: Given you use a DataTable , e.g.: ' example DataTable ' Dim dt = new DataTable() dt.Columns.Add("cameraID", gettype(integer)) dt.Columns.Add("MarkerName", gettype(string)) dt.Rows.Add(new object() {2, "Home Depot"}) dt.Rows.Add(new object() {1

how to pull data from DB/datagridview/datatable

 ̄綄美尐妖づ 提交于 2019-12-25 02:12:11
问题 I have this table.. and I want to pull a specific data.. Let's say.. I have Home Depot as a button. how can I pull the CameraID value of 2 and put it on a variable.. something like this.. 'dim foo as string = cameraID where MarkerName is Home Depot 回答1: Given you use a DataTable , e.g.: ' example DataTable ' Dim dt = new DataTable() dt.Columns.Add("cameraID", gettype(integer)) dt.Columns.Add("MarkerName", gettype(string)) dt.Rows.Add(new object() {2, "Home Depot"}) dt.Rows.Add(new object() {1

c# adding a variable in a SQL dynamic pivot string

北城余情 提交于 2019-12-25 02:08:08
问题 I am trying to show the results of a dynamic pivot in a c# datagridview. So far I have got the following code but I am stumped as how to incorporate the @Date variable in the @query string. What am I missing here? The code works fine with hard coded dates and as it is returns Additional information: Incorrect syntax near '@Date'. Please help, Thanks, A da2.SelectCommand = new SqlCommand(@"DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX); SET @cols = STUFF((SELECT distinct ',' +

Searching a DataGridView for a match or partial match

喜夏-厌秋 提交于 2019-12-25 01:59:02
问题 Tried to sift through the google results; no luck. What I'm trying to do is, given some text in a TextBox: search for at least a partial match in any column of my DataGridView, and have the control select the first row (show it as the top row and have it highlighted) that it encounters with that partial match. Here is my declaration of the DataSource for the DataGridView and how the columns are organized: var queryData = from va in xdoc.Descendants("language") select new { StringID = va

How do I bind a WinForms DataGridView control to a SQL Server database

我的未来我决定 提交于 2019-12-25 01:52:43
问题 I am a .NET noob who is trying for figure out how to bind a grid control to a SQL Server database so that when rows are inserted, updated or deleted from the grid, they are also inserted, updated or deleted from the database. C#, .NET 3.5, VS2008 SP1 Warren 回答1: Drag the control on the form. Then click the small arrow at the top right corner of the DataGridView to open up a menu. Select Choose your source, and select your database or dataset. Then on the same menu, you can choose whether to

Pass Value from Form2 ListView to Form1 DataGridView

喜欢而已 提交于 2019-12-25 01:46:46
问题 I've 2 forms in C# Application, Form1 is main form containing DataGridView, columns are AccountCode, AccountName, Amount, Narration. At present user can enter AccountCode manually and using Sql query AccountName is populated with relevant title. Now I am looking for a way to that user will search AccountCode in Form2 containing ListView holding AccountCodes and AccountName, after user DoubleClick or press OK button return selected value to Active row in Form1 DataGridView. Active Row is the

How to Pass data table from DataGridView to ReportViewer

有些话、适合烂在心里 提交于 2019-12-25 01:44:16
问题 How to Pass data table from DataGridView ro ReportViewer ? in a win Form I have a DataGridView control that fills from a SqlDataAdapter , and I added a check box column to it. for "ready to print"(or smt like this) now I want to create a report with ReportViewr to show only checked rows in my DataGridView. here is codes of my form1 (Contains datagridview) private void Fill_DGV_Sefaresh() { try { MyDB db = new MyDB();//class that contains my SQL Connection string sql = "SELECT sid, CONVERT

DataGridView - Can focus be placed on the blank row with the (*) using code?

為{幸葍}努か 提交于 2019-12-25 01:33:15
问题 On a data grid view there is a blank row with a (*) in it that allows the user to insert a new row of data. Is there a way to put focus on that row using code even though the data grid view has many rows already loaded in it? 回答1: dgv2.CurrentCell = dgv2(0, dgv2.Rows.Count - 1) 来源: https://stackoverflow.com/questions/10641749/datagridview-can-focus-be-placed-on-the-blank-row-with-the-using-code

LINQ to SQL datagridview query returns length, not value

和自甴很熟 提交于 2019-12-25 01:22:16
问题 I've got a Windows Form with a button and a datagridview. The project includes a working database connection and LINQ to SQL class. I'm trying to bind the datagridview to the LINQ to SQL. In a code module I've got this: Public Function DataGridList() As BindingSource Dim NewBindingSource As New BindingSource() Dim db As New DataClasses1DataContext() NewBindingSource.DataSource = _ From Block In db.BLOCK_ASSIGNMENTs Where Block.gr912_school = "Franklin" Select Block.gr6_school Distinct Return