Questions tagged [datagridview]

1

votes
0

answer
6

Views

Is there a way to remove the selection line(highlighted) in a databound combox on a datagridview?

I am having trouble with a databound datagridviewcomboboxcell I want to remove the blue selection line that appears on a databound comboboxcell. I noticed that if a comboboxcell is not databound but has a collection of items, the blue line does not appear. however a databound combobox does have it....
Stuart Black
1

votes
1

answer
1.9k

Views

How to determine which DataRow is bound to a DataGridViewRow

When I use a DataTable as a DataGridView's DataSource, I often have to find which row(s) a user has selected and read specific values from the DataTable (not the DataGridView) I wanted to know if there is any reliable way of determining which DataRow a DataGridViewRow is bound to especially when the...
Alex Essilfie
1

votes
2

answer
9.2k

Views

Read Only Columns & Rows in a DataGridView

I have a datagridview in a WinForms application and I want all columns bar one to be locked to editing. This I was able to achieve with the following code: foreach (DataGridViewColumn col in myGrid.Columns) { if (col.Name == 'LockedColumn') { col.ReadOnly = false; } else { col.ReadOnly = true; } }...
PJW
1

votes
1

answer
1.9k

Views

How to Password Char a Column in DataGridView

I am trying to password char a column when loading in a table. Code below loads the table. //Fills out Student table private void loadStudentTable() { SqlConnection conn2 = new SqlConnection(@'Data Source=(LocalDB)\v11.0; AttachDbFilename=C:\Users\Donald\Documents\Visual Studio 2013\Projects\Desktop...
D B
1

votes
3

answer
56

Views

C# datatable Entity Framework

I have two objects people and house, and I want to show the table people in a datagridview, but in the field House, the value shown is Program.Model.House; I want to show the street name instead, how I can do it? (I'm using Entity Framework and the data source of data grid view I use context.tolist(...
L.Text
1

votes
1

answer
114

Views

DataGridView is not committing updates to database

I used the designer to set the datagridview's data source to my SQL database table. On the RowLeave event, I use the BindingSource.EndEdit to commit the changes. However, the changes in the datagridview aren't being reflected in the database. The EndEdit is being called correctly. private void UI_DG...
B-Rian
1

votes
1

answer
63

Views

Binded DataGridView only updating the currently selected row

I'm working on getting my DataGridView controls to auto update the values of my objects in my object model. I have object arrays that I'm binding to my DataGridView through the following code Dim bs As BindingSource = New BindingSource() bs.DataSource = aryJoints DataGridJoints.DataSource = bs I am...
RobotGuy
1

votes
2

answer
158

Views

C# Handling two buttons within the DataGridView

I'm currently developing a C# project that displays the users' orders. Now, being that I am new to this I'm asking you to assist me on how I could possibly access the two buttons from within the DataGridView and give them separate functions. Where I've got at code wise: private void dataGridView1_C...
user7943
1

votes
1

answer
49

Views

C# Assistance in foreach datagridview data removal

Scenario: I am loading a DataGridView with data from a database, so in order to do so I'm using a foreach-loop, now the problem here is that when going on the DataGridView for the second time it loads the data from before and the data being looped in now. In order to fix that I did this: private vo...
user7943
1

votes
1

answer
50

Views

unrendered portion for datagridview c#

So I'm doing a project on Win-forms using c# and i have this DataGridView that's anchored to the each left and right side of the panel. For some reason the right side of the DataGrid is not rendered for some reason.(image in the link below) If i rescaled my PC resolution when running it will fix the...
user9177098
1

votes
0

answer
532

Views

C# datagridview cell with autocomplete LIKE

I am trying to create a desktop application for my store. My application currently using AutoComplete item like this screenshot shows: Now I want to change that cell to autocomplete with LIKE function. For example: my item list contains ['book', 'brush', 'pen', 'samsung note 1', 'samsung note 2', 's...
1

votes
0

answer
195

Views

Why is DataGridView (re)draw so slow?

I know there are several questions in SO about slow DataGridViews, but I tried really everything mentioned there and most are about more complex databinding. what I did before: I tested DataTable as Datasource unbound Datagridview, populated in a loop tested many setting with autoColumnResizing etc....
Falco Alexander
1

votes
0

answer
58

Views

Unable to open Hyperlink in Browser

I have DataGridHyperlink column HyperLinks to images stored on disk. When i click on Hyperlink my image gets displayed successfully but i get this error 'FAILED TO CONVERT RESOURCE INTO OBJECT'. My code for datagridhyperlink column is below. below in code s_man_image is being retrieved from database...
Niazi
1

votes
0

answer
160

Views

Adding data from barcode scanner to DataGridView makes my app crash C#

I have an app that reads barcode from a OPOS Scanner using POS for .NET 1.14 and then add it to a DataGridView. My problem is that the application hangs(not in debug though for some reason) after 2-3 scanned barcode, it seems like it hangs when the data added to datagridview makes the vertical scrol...
SilentRage47
1

votes
1

answer
23

Views

Bound datasources being updated in non-UI threads

I'm trying to use Grpc, which in its example for bi-directional streaming uses this example: using (var call = client.RouteChat()) { var responseReaderTask = Task.Run(async () => { while (await call.ResponseStream.MoveNext()) { // // What if I want to update a list bound to a UI // control here? //...
Nils Guillermin
1

votes
1

answer
349

Views

How to open form when specific cell on datagridview double clicked in visual basic?

i have a datagridview, more like this: +-------+-------+-------+-------+ | a | b | c | d | +-------+-------+-------+-------+ | 1. | asdf | sda | sdfs | +-------+-------+-------+-------+ the problem is how to make a cell ex: asdf click and a form will show? but when sda or sdfs...
Putri Alvionia
1

votes
0

answer
61

Views

DropDownList inside a Gridview loses value on postback

I have a dropdownlist inside a gridview which shows the initial value when i change the value in the dropdown. The second time I change the value, the value persists. Please help me figure what I am doing wrong. I have went through many solutions before posting here. I am not using an Update Panel.I...
Aarthi Muthusami
1

votes
2

answer
58

Views

Can't select row or control the scroll bar with DataGridVew

Maybe this's a newbie question.But I've been searching high and low with no luck as whatever I tried didn't work. I have a DataGridView named dgvDeviceList which contains 5 columns:ID,Device Name,Mac Address,RSSI and Advertisement Type in the FormMain window. When I use a method to scan the Blueto...
Ringo
1

votes
0

answer
248

Views

C# WinForms DataGridView: drop down opened/closed event?

Is there a chance to know when the dropdown list of a DataGridViewComboBoxColumn is opened (and closed), regardless of the eventual value change? I'm asking because I'd like to stop the underlying DataSource from updating, while the dropdown list is open. The DataSource updates once every second, an...
Alberto
1

votes
3

answer
42

Views

C# datagridview binding source with image path if not existing

Hello i have one question, im getting data to datagridview with bindingSource, my code is bellow; string query= 'SELECT a.id as id1,a.id2, a.system_id, CONCAT(b.path,a.image) as photo ,b.id as id5,b.name,b.path FROM users a INNER JOIN systems b ON a.system_id=b.id order by a.id DESC LIMIT 20'; usi...
linuxman1993
1

votes
0

answer
166

Views

C# DataGridView Column custom ValueType

I have a simple DataGridView, and a custom type MyType, which looks like this: class MyType { public string Prop1 { get; set; } public int Prop2 { get; set; } public MyType(string Prop1 = 'Empty', int Prop2 = 0) { this.Prop1 = Prop1; this.Prop2 = Prop2; } public override string ToString() { return t...
Vlladz
1

votes
0

answer
39

Views

Show data that is in BindingList to DataGridView

Solution: Thanks for Nikita Marinosyan. He found solution Here I have an Excel document. There are columns like fax, email, number and so on. In program I have a class Contact public class Contact { private List phones; private List faxes; private List email; private List webSite; public string Phon...
1

votes
0

answer
66

Views

Load DataGridViewImageRow Async

So I'm loading a set of 100+ rows for a DataGridView that has an DataGridViewImageColumn inside it. Currently, my code is waiting for req.GetImageFromURL(t) to download the image before each row can be added to the DataGridView as this is taking a long time per row The DataGridView is unresponsive u...
Simon H.
1

votes
0

answer
34

Views

Showing images with data in datagridview wpf

Can we bind the image column from a different source and the other columns from the datatable?
Wajid Ali
1

votes
1

answer
29

Views

DataGridView loses data after failed validation

I have a DataGridView bound to an Access database in a Windows Forms Application. When I create a new row and enter invalid data (validated against the rules set in Access, e.g. cell cannot be empty), then move to a different row, the data is lost. No errors thrown or error information on the DataGr...
GenWells
1

votes
2

answer
255

Views

Show the selected row record in textbox/label

How do I make the selected row record from a DataGridView show in a TextBox? I got some TextBox andLabelin aForm. I want the text inside theTextBox/Labelto change when the user selects a row record from theDataGridView`. I tried the following code to make it happen, but it doesn't work private void...
Knugi
1

votes
0

answer
53

Views

Datagrid values shows up in wrong position

I have a datagridview which displays the data from my database. However, whenever I clicked in the datagrid for the first and second time, data shows up in the designated textboxes but after several saving and updating, it will show up in wrong textboxes. The problem showed up after I added the bind...
hevhev011717
1

votes
1

answer
59

Views

C# datagridview cell value edit is undone after changing current cell

I hope you can help me. I didn't find a solution which fits my problem by googling. I have a DataGridView with no bound data. When the user double-clicks in a cell he can write a new value into the cell. Based on the change, the value in the neighbour-cell is changed too. This is working properly so...
Tobi
1

votes
1

answer
223

Views

Can i create reports and print DataGridView data in c#?

I have this code in which the user needs to create Price Offers for clients, the user searches the database for products by entering the name of the product and gets all the matching results in a DataGridView and then he chooses the product he wants to include in the price Offer and adds the amount...
Suhail Taleb
1

votes
1

answer
125

Views

Yii2: GridView Sorting removed from column header

[ 'header' => Yii::t('app', 'Price') . ' usd.', 'contentOptions' => [ 'class' => 'text-right'], 'attribute' => 'price', 'format'=>['decimal',2], 'headerOptions' => ['data-type'=>'number'], ] I need view formatting money, but it removes the sorting link for the column from the header. I Use footable
Nikita Shahov
1

votes
1

answer
50

Views

New rows missing from DataTable upon ColumnChanged

I am displaying a DataGridView to the user. This DataGridView has its DataSource set to a DataTable with an identifier ('ID'), alongside other data. Every time a value in the ID column is changed, I want to iterate over all rows to check whether the ID is truly unique; however, I want to avoid doing...
A. Brishemed
1

votes
0

answer
106

Views

Sum Amount from Datagridview with Other Textbox and Show it Automatically

Screenshot Hi. I need help from you guy. How do I calculate or sum all the value into the last textbox. I put number in my picture just want to explain what I need here. I put some amount to calculate GST and show it to Total Legal Fees textbox. After number 1, I put temporarily amount just to put m...
Thoiruddin
1

votes
0

answer
23

Views

check for duplicate on lose focus in datagridview

I am trying to write a data input app using Visual Studio 2017 C# for my company. We have 2 tables, SI and SIC, in a SQL DB. I have created a form and put a bound datagridview, which is bound to the SIC table. On form load, it shows all data nicely. What we want to do is enter data into this datagri...
Kevin Ray
1

votes
1

answer
68

Views

How to represent Infinity in float column using datagridview? [closed]

My issue currently is that I have users using a column like 'MaxLimit' or something similar which should represent a monetary value. Unfortunately, they also want to have an Infinite option. Currently, based on older code, this was represented by the users entering 999999999, which is a little barb...
Austin
1

votes
1

answer
88

Views

Search anywhere in DataGridView

I'm trying to write a program which will made a datagridview based on a text file. See code below. private void Button1_Click(object sender, EventArgs e) { ls_datenTabelle.Clear(); ls_datenTabelle.Columns.Clear(); string kdstr = (comboBox1.SelectedItem.ToString()); string fileName = 'ls.txt'; string...
Scheennie
1

votes
0

answer
21

Views

How to display JSON sting in datagridview (cell merging)

I need to display my JSON sting in c# windows form application's dataGridView. so I use this code and its works properly. public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string myDynamicJSON = '[ { 'Company': 'Compan...
Adam
1

votes
0

answer
54

Views

Fastest way to update a DataGridView connected to asynchronously and constantly updating DataTable

I'm currently using a DataGridView and a DataTable as so: mydataGridView.DataSource = myDataTable; myDataTable is constantly receiving new information from a webfeed. The issue I'm having is that myDataGridView will remain stagnant when myDataTable has changed. I'm guessing this has to do with being...
Jesse A
1

votes
0

answer
38

Views

How to keep updating DataGridView when database is updated

I'm working on a program that uses NHibernate to communicate with a SQL Server, and displays a table in a DataGridView. This is how I initialize my DataSource: private void UpdateDatabaseBindings() { if (InvokeRequired) { InvokeUI(UpdateDatabaseBindings); return; } using (var session = NHibernateH...
Ilan321
1

votes
0

answer
34

Views

Print Checboxcolumn from Datagridview to Crystal Report

I nee a help. I have a datagridview and have a checkboxcolumn in the last column. Which row is checked, it will be send to crystal report. In the crystal report, I only get the last checked even I check many records. Anyone can help me? I use Vb.net For i As Integer = 0 To dgv1.Rows.Count() - 1 Dim...
1

votes
1

answer
53

Views

Datagridview winforms cells doesnt get updated unless focus back on the grid

I am working with winforms c# datagridview and ran into a bug that I m not sure how to resolve. I have a datagridview in which the datasource is a datatable. The datagridview contains editable text fields and cellvaluechanged event as well as button column which I respond to thru a cellclick event....
JoeyDiaz

View additional questions