datagrid,vb6 , Change DataGrid cell value in VB6

Change DataGrid cell value in VB6


Tag: datagrid,vb6

Good day guys. I am developing VB6 project and I know it's old but thats the standard in Japan. I am not into datagrid expert guy that can tweak everything inside of it but my problem is that I have data to be displayed in datagridview which they want to change the cell value if the data having value for example :


apple | 1

orange | 2

So if apple having QTY value of "1" I want to change it into something like star or circle value.

It's a datagrid control(databound) in WinForm App. My datasource is sql server.

Thank you guys in advance.


The technology (VB6) is indeed very old; you can try something like

Sub AddSymbol()
For i = 1 To DataGrid1.Rows
    If DataGrid1.Item(i, 2) = 1 Then DataGrid1.Item(i, 2) = "*"
Next i
End Sub

where quantity is stored in the second column of DataGrid1 control. Hope this may help.


If statement not working in vb6

I want to make a program which could close a window with the title "Personalization" in vb6. The problem is that the if statement is not working.Here's my code(it only finds a window named "Personalization" without closing it): Option Explicit Private Sub Command1_Click() Timer1.Enabled = Not Timer1.Enabled End Sub Private...

How to populate a DropDownList in a DataGrid?

I have a DataGrid that displays information about trailers. I decided to change the location column to a DropDownList so the location can be easily changed. But I am not sure how to populate the DropDownList. <asp:DataGrid runat="server" CssClass="tblResults" OnItemDataBound="dgList_ItemCreated" OnRowDataBound="OnRowDataBound" AllowSorting="true" OnSortCommand="dgTrailer_Sort" ID="dgTrailers" DataKeyField="ID" AutoGenerateColumns="false"> <Columns> <asp:BoundColumn DataField="TrailerOwner" HeaderText="Owner"...

SELECT * FROM giving other result then SELECT 2010,2011 FROM

when i try to get the values from some columns and use SELECT 2010,2011 FROM blablatable then i get only the table names(checked in a browser). When i use SELECT * FROM blablatable then i get (of course everything) but then the content of the year colums are displayed correct(checked...

WPF DataGrid: Displaying 2 decimal places when not editing, but full number when editing

im am trying to have a datagrid, where when the user enters the value and presses enter, it displays the data with 2 decimal points of precision. However when they click in to edit it, i want them to be able to view the whole number again. What i currently...

Update DataGrid cell if other cell changes

I have a View that displays a Part. All parts contain a list of identifiers. In my View I display Part Properties and a DataGrid with all the Identifiers of that part. Now if I change a value of an identifier, I want another value update to the default. But...

Negate a specific group in regular expressions

How do you get a string not containing a specific group? (?:[0-9-+*/()x]|abs|pow|ln|pi|e|a?(sin|cos|tan)h?)+ Above string is the expression for mathematical expressions. How do you get the string that is not a mathematical expression? Example:WIDTH+LENGTH*abs(2) Supposed Output: WIDTH LENGTH...

Insert a blank row into a Datagrid with dynamic columns

I create the columns of my Silverlight DataGrid dynamically in the code behind using a List as follows: private void BuildQuotationDGColumns(List<ProductCategory> ProdCatList) { // add a template column with drop down list of products DataGridTemplateColumn ProductColumn = new DataGridTemplateColumn(); ProductColumn.Header="Choose Product"; ProductColumn.CellTemplate=(DataTemplate) Resources["ProductDDLTemplate"]; QuotationDG.Columns.Add(ProductColumn); // for each entity in ProdCatList...

WPF DataGrid Trigger on cell content

I have a datagrid than contains value comes from a stored procedure. All values are set Bold as FontWeight. I'd like to make the text normal when the cell content is equal to 0. How can I do that with a trigger? I do that but seems not working <DataGrid.CellStyle>...

Databinding ObservableCollection to Datagrid not working

Update Now I think I have narrowed the problem. I created single class public class OptionStrike { public OptionStrike(double p1, double p2, int p3) { // TODO: Complete member initialization P_OI = p1; StrikePrice = p2; P_Volume = p3; } public OptionStrike() { // TODO: Complete member initialization } public...

WPF AutocompeteBox in datagrid Cell does not work properly

I am testing the WPF AutoCompleteBox control in datagrid cell. I met two problems: 1) when i navigate to the autocomplete cell , it does not automatically switch to edit mode, 2) When I switch into edit mode and I type something, the list of suggesstions doesn’t appears and I...

Team Foundation 2012 not recognising changes in vb6 app

I'm using Team Foundation 2012 to provide source control for a VB6 (yes, I know) project. On a newly set up machine (installed Team Explorer 2012 and TFS Power Tools 2012), TFS does not seem to be properly noticing the changes. The local Team Explorer says it is connected to...

VB6 code explanation,vb6
I need to convert some of the legacy code which is currently in VB6 into C#. I am not able to understand this piece of code. Especially the InStr function, could someone please help me out with this and suggest me it's C# equivalent. For i = 1 To Len(sString)...

GetWindowsDirectory() API returns wrong (vba\vb6)

on my Windows-Terminal user, I'm trying to have two application point to the same Windows directory, one written in VBA one in VB6. When calling the GetWindowsDirectory() API from VB6 it returns the correct path C:\documents and settings\%user%\Windows When calling it from VBA macro, it returns C:\Windows Notice that same...

RowAction in a Vector source APYDataGridBundle Symfony 2

Im stuck with this issue for a few days, i currently have grid filled with results from a Stored Procedure, i run a nativequery with the SP, get the results in an Array and use the Vector class from ApyDataGrid to display the results. All of the above is working...

How to convert vb6 'vbFromUnicode' to string in C#

I got as code in VB6, which need to be converted in C#. I have googled it but didn't get any concrete answer. VB code: Dim strTemp = StrConv(strTemp , vbFromUnicode) I tried to do like this in c#: var strTemp = System.Runtime.InteropServices.Marshal.StringToBSTR(strTemp); I think this is not correct. Any...

Convert 10009335357561071 to hex string

Public Function MyMod(a As Double, b As Double) As Double MyMod = a - Int(a / b) * b End Function This code doesn't work as it doesn't correctly show the remainder do be able to then calculate HEX. Correct : 10009335357561071 / 16 = 62558345984756.69 VB6 MyMod returns 0...

Datagrid shows only one record

everything looks fine from my point of view, but the dataGrid shows only the first item which has been added to the grid. The XAML part: <DataGrid HorizontalAlignment="Stretch" Name="dataGridIE" VerticalAlignment="Stretch" HeadersVisibility="All" CanUserReorderColumns="False" CanUserResizeColumns="False" AutoGenerateColumns="True" ColumnWidth="100" CanUserAddRows="True" CanUserDeleteRows="True" Height="97" Margin="23,38,16,38" Grid.ColumnSpan="2" Width="682"> <!--<DataGrid.Columns> <DataGridTextColumn Header="Key"...

Can't add TemplateField to Datagrid

I am trying to add a DropDownList into the DataGrid so the location column can be easily changed. I am getting an error with TemplateField, itemtemplate, label and DropDownList. I get the build error: is not allowed within a 'System.Web.UI.WebControls.DataGridColumnCollection'. <asp:DataGrid runat="server" CssClass="tblResults" OnItemDataBound="dgList_ItemCreated" AllowSorting="true" OnSortCommand="dgTrailer_Sort" ID="dgTrailers" DataKeyField="ID" AutoGenerateColumns="false"> <Columns>...

Edit DataGrid Cell on mouse over

I have a DataGrid which has plenty rows and columns, I want to get the cell ready for editing when the user focus the mouse on it (IsMouseOver). So far, all I found is this <Window.Resources> <Style TargetType="{x:Type DataGridCell}"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="green"></Setter> </Trigger> </Style.Triggers> </Style> </Window.Resources>...

Validating texbox control within gridview

I am developing an application where teacher are allowed to enter marks for students, based on selecting a subject they teach. Now I am using a 4 columed datagrid to which I am populating all the student rollnum(1st col) and name (2nd col) and textbox control to enter Test marks(3rd...

WPF: Programatically adding a ContextMenu to a DataGrid column header

I'm trying to add individualized and separate ContextMenus to each column header in my project, so that when a user right-clicks a header, a menu of checkboxes that relates to that header will appear that allows them to filter the data. A couple of catches: the project that I'm working...

SelectedRow and DataBoundItem in WPF as it gets?

I'm passing a basic design of client registration that was made in Windows Form to WPF, and I had a problem in the code that the WPF does not have the selectedRow and then immediately there is also the DataBoundItem. Does anyone know how I can transcribe this code for...

DataGridRowTemplateColumn - refactoring and using styles efficiently?

I currently have a big lump of XAML that I am struggling to refactor. <DataGrid x:Name="CurrentConfigDataGrid" ItemsSource="{Binding}" > <DataGrid.Resources> <ResourceDictionary Source="../ResourceDictionaries/MergedDictionary.xaml" /> </DataGrid.Resources> <DataGrid.ItemContainerStyle> <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}" /> </DataGrid.ItemContainerStyle> <DataGrid.Columns> <DataGridCheckBoxColumn Width="25">...

How do I highlight a row in the WPF DataGrid when SelectionMode is set to Cell

I have a DataGrid bound to a DataTable in a WPF application. The SelectionUnit of the DataGrid has to be set to Cell, but I'd also like to add a subtle highlight to the whole row so that on wide DataGrids, when the user scrolls off the selected cell they...

Using the FooTable plugin with the ASP.NET DataGrid,,gridview,datagrid,footable
I am currently redesigning an application for the company I work for. All the data is displayed through a DataGrid, which is fine, except for when I try to incorporate a JQuery library called "Footable" to make all the grids collapse when on a smaller device as explained here. In...

Regular Expression for whole world

First of all, I use C# 4.0 to parse the code of a VB6 application. I have some old VB6 code and about 500+ copies of it. And I use a regular expression to grab all kinds of global variables from the code. The code is described as "Yuck" and...

How to edit HeaderText for TemplateColumn inside DataGrid

I have a client that is requesting that the HeaderText is changed for specific products so that instead of "TL Price/1000 sq ft" it says “TL Price per Pack”. On the previous page a customer can select multiple categories which will then show multiple tables on this page for the...

Visual Basic Datagrid View change row colour,datagridview,datagrid
Every other change to the datagrid view works fine but for some reason the row color just wont change. Ive debugged and my application goes through the loop to change the row color. Also I have a button that gives the datagrid view a new list and colors the rows...

Compare items in an Array to items in a Variant in VB6

I have a Variant in VB6 with thousands of Strings. I also have an array of fixed length. I need to compare the contents of each and add the ones that match to a list. if array(i) = variant(1,i) then 'add to list End if I cannot figure out how...

WPF, DataGrid, clicked item/row does not highlight (blue background)

Here is the DataGrid XAML: <DataGrid CanUserAddRows="False" AutoGenerateColumns="False" Height="501" HorizontalAlignment="Left" Margin="6,6,0,0" Name="dataGridTrades" VerticalAlignment="Top" Width="574" SelectionChanged="dataGridTrades_SelectionChanged"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding TradeID}" IsReadOnly="true"/> <DataGridTextColumn Header="Account" Binding="{Binding AccountName}" IsReadOnly="true"/> <DataGridTextColumn Header="Card Name" Binding="{Binding...

Set vb6 form to instance of a hardcoded form

I have a 2 Forms. Form1 opens Form2. Form2 after clicking a value, sends that value to a textbox located in Form1. It is hardcoded so that inside Form2 it explicitly states Form1.txtbox.Text = "Whatever i clicked" Form2 then closes and I am now sitting at Form1, however the txtbox.text...

Datagrid inside a Custom control is not updating

In my Custom Control that have a DataGrid and two buttons, one for add rows in this DataGrid and other button to remove elements. (because of my reputation I can not post an image here, sorry!) :-( My Custom Control code behind: /// <summary> /// Interaction logic for UserControl1.xaml ///...

Change DataGrid cell value in VB6

Good day guys. I am developing VB6 project and I know it's old but thats the standard in Japan. I am not into datagrid expert guy that can tweak everything inside of it but my problem is that I have data to be displayed in datagridview which they want to...

Need code for removing all unicode characters in vb6

I need code for removing all unicode characters in a vb6 string.

ASP.NET DataGrid is empty

I have a ASP.NET datagrid which is on a user control. I have a main page which adds the user control ( sometimes multiple copies of the user control ) and restores them when a post back occurs. The dataGrid has insert / edit / delete links. I can add...

Custom WPF DataGrid with optional button column

I am creating a custom DataGrid control which has a property, ShowCloneColumn. If you set this property to true the DataGrid should add another column with a Button. The class I've created derives from DataGrid and implemented a Dependency Property, ShowCloneColumn. public static readonly DependencyProperty ShowCloneColumnProperty = DependencyProperty.Register("ShowCloneColumn", typeof(bool), typeof(CloneRowDataGrid),...

Laravel 5 / zofe/rapyd-laravel Datagrid : ErrorException in Factory.php line 150: array_merge(): Argument #2 is not an array

This is my first post on stackoverflow :) I am new to Laravel and tried to display an array into a grid. I choosed zofe/rapyd-laravel Datagrid, but even if it seems simple I cannot get it to display.. Here is my code : public function index() { $reader = Reader::createFromPath('../uploads/pcl.csv');...

C# XAML - How to add a combobox to some datagrid ROWS but not others?

I'm using a key/value observable collection to hold data which is represented in the view by a two column datagrid. Some key values contain a list of items and other key values contain a single string value. Using the below code snippet I'm able to display those key values with...

Structure of WPF DataGrid - change cells depending on value

I did bind an Object to a DataGridTextColumn and would like to reference one of its properties from within the corresponding CellStyle. I assumed that each cell of this column would contain an instance of MyObject. However I can't find a reference to the Object from within the DataGridCell (I...

Change parameters On error in vb6

I am working with vb6 and automating some tasks to be performed across a large number of spreadsheets. The issue is setting my worksheet. Most of the syntax on the workbooks I am working with is the same however there are some where the sheets have different names. Currently using...

Reading VB6 three-dimensional array in FreePascal/Lazarus

I wonder how to decode a three-dimensional dynamic array of a custom type written to a binary file in VB6. The custom type is defined as follows: Type XYByte X As Byte Y As Byte End Type It represents two coordinates of a contact point. The three-dimensional array represents pre-computed...

Alter Display Text in Data Grid

A Dynamic Datagrid is being created, and I need to alter the text being displayed in the data grid w/o changing the data in the database. I tried doing the below, but it presents an error of the below. If more code is needed to be seen, let me know....

Binding DataGirdComboBoxColumn to DataSet doesn't work

I want to create a simple master-detail view in a datagrid. I tried to bind a DataGirdComboBoxColumn to a DataSet, but it won't work. Here's my xaml code: <DataGrid x:Name="DataGrid1" Grid.Column="0" Grid.Row="0" AlternatingRowBackground="#FFF0F0F0" ItemsSource="{Binding}" Height="420" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding AirplaneID}" IsReadOnly="True" MinWidth="30"/> <DataGridTextColumn Header="Model" Binding="{Binding Model}" IsReadOnly="True" Width="Auto"...

Bug in a Scroll of DataGrid - WPF?

I hope you can help me with this: I have a DataGrid with 20 rows and every time I check the checkbox in one of the columns, a label value is increasing by 100 each time or decreasing if unchecked. So, once I've checked all the rows the value of...

Databinding a Datagrid

After being unsuccessful in databinding my Observable collection to my datagrid (Another question in this same forum), i tried to reduce the scope. Now my project has only one datagrid, one ObservableColection and one class. But still my databinding is failing.. please help.. using System.Collections.ObjectModel; using System.Windows; namespace TestDatagrid {...

Linq query to return country as column and cities as rows and count in cells

I have this table in db : | Buyer Country| City |... |:-------------|-------:|... | Uk | Lisbon |... | Portugal | London |... | France | Madrid |... | France | Lisbon |... | France | Madrid |... | France | Madrid |... And i would like to get a...

How to bind a datagrid row with text boxes in wpf mvvm

I have a DataGrid which contains some Product details , i need to load the product details into some textboxes when i double click on a particular product in the datagrid. Thanks in advance....

SQL query to return maximum values from multiple columns

I have the following tables in a SQL Server 2008 R2 database: Customers ========= CustID CustName ====== ======== 0 NULL 1 A 2 B 3 C InterestingCustomers ==================== CustID ====== 0 1 3 Orders ====== CustID OrderID InvoiceTotal Discount ====== ======= ============ ======== 0 NULL 2000 NULL 0 100 NULL...

In a WPF datagrid, how do I get the new row after cell edit?

My DataGrid is bound to a DataTable. After each cell edit in the grid, I need to get the new DataRow value. I get the new values only after the focus is lost from the row and not the cell. <DataGrid ItemsSource="{Binding}" CellEditEnding="grid_CellEditEnding"/> private void grid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e) {...