I have made a datagrid in a WPF and added a button to add rows, here is the code for that:
this.itemListDataGrid.Items.Add(new TextBox());
Also, I have already got 3 colums in the datagrid pre-added by me, so when the rows are added I click on one to edit it and it comes up with error edit item not allowed.
I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?
I am trying to get a datagrid working in my program with populating a simple set of data. Which i can then expand on and bring in data from a database.
But even this little simple test datagrid does not seems to be working.
I'm trying to create custom WPF control, similar to DataGrid. DataGrid was great as a base class for a different custom control I needed, because I could do something like this:
public class Person { public string Name {get; set;} public string Phone {get; set;} public string Email {get; set;} }
... and I can reuse it elsewhere with collections of different type, binding its properties to columns of different width and style.
What I need now is something similar, but differs in a way, that DataGrid is no longer good fit for the base class.
What I'm interested in is: how does DataGrid "tell" the columns in Columns collection, to have the type of ItemsSource bound collection as a DataContext? How does the Name property of Person class become available to the column in DataGrid.Columns?
I have been struggling to implement a method for reading data from SQL server to my C# program. In the C# program I prepared a DataGrid (not a DataGridView) for the data to be shown in it using a button "Load Table". Now I just want to read a table which has 4 different columns which I also added to the DataGrid.
I have a DataAccessDB class and this is the code for establishing a connection:
const string DB_CONNECTION = @"It is known to me"; SqlConnection con; SqlCommand cmd; Controller myController;
Then, there is a code to reference controller:
public DataAccessDB(Controller refController) { con = new SqlConnection(DB_CONNECTION); cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; myController = refController; }
And this is the code for a List which I am going to use for filling the data to a DataGrid:
public List<ProductionStock> GetProductionStockFromDB() { int productionStockId, amount; decimal price; string name, descript;
[code]....
And now the main part - how to read the data when I press a LoadTable button. The point here is that I already defined connection strings here as you can see, and in the method itself I guess I should not repeat it. The tutorials I have seen they do it everything in that one button.
the code works and produce a table and fills the grid, what im trying to do is get this information into a DataGrid, so i can get rows selected by user. ive tried many ways ie convert the list into a datatable and display but produces errors, ive done the following,
ive added the HTML code to set up the datagrid, which i can see via design tab, but filling it up is harder.
i uderstand it needs a
protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; sqlDataAdapter1.Fill();// where it require a dataset or datatable DataGridProduct.DataBind();
as it requires a datatable i converted the list to a datatable when i run it it says null, im not sure where im going wrong, i noe the list works as i tried populating on a table.
public static DataTable ToDataTable<T>(List<T> items) { }
I have a datagrid, which has a column called Status. In the database, the field is a text field that can have the values up, down, or danger.
I needed to display the status as a "light" as per client request, so I have a StatusToImageConverter class that receives the status, and returns the proper image to display in the datagrid column. Works fine.
Now the issue I am having... I have a combo box above the datagrid for the user to filter the results if desired. The filtering works fine, but the newly displayed devices do not have their status light. In the Status column, nothing appears after the user filters. I think it may have to do with the fact that I am not re-initializing the datagrid, but just refreshing it? That's just my educated guess.
XAML: In the UserControl Resources:
<local:StatusToImageConverter x:Key="ImageConverter" /> In the DataGrid Control: <DataGridTemplateColumn Header="Status" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate>
I want to be able to keep on adding a row to my datagrid every time i click a button, the row will hold the text of the text box and the combobox in its individual cells, is there a way to do this without inserting a ridiculous amount of code?
In the last line "graph.edge{x,y,w}" it says typename is not allowed? I have used nested class edge and pushing vertices and their weight in elist vector which is of type edge.
but when i select a collumn, i recive an error because i'm selecting a cell with the mouse and i dont have code for that selection. My question is how can i put an "if" on the beguining of the event so that he can determine if it's a header or not.
I am trying to get a program to take two files and place them into a third file. I have searched all over this website looking for a solution and i can seem to find one.
My issue is that i keep getting an error 'incomplete type is not allowed' as well as 'no operator matches these ">>" these operands.'
#include<iostream> #include<string> #include <sstream> using namespace std; int main() { string filename1;
So, I ran into the above error. I can't post the actual code, but here is the setup... I have four classes: A, B, C, and D.
A.hpp
Code: class A { public: virtual void foo( D& bar );
[Code] .....
In A.cpp I implement foo and use bar in a similar manner as shown in class C. The difference here is that in A.cpp I also include the header for the D class. I am a bit confused why I can pass bar to B::foo() and that works fine, but if I try to access bar in C::foo, I have issues. Currently I am just including D.hpp in C.cpp.
When declare and assign an instance of a user-defined struct in a function. And the struct (theStruct) is not declared in the same header file as the function (theFunction). Like this:
files: "A.h": declares the struct in a class (theClass) "A.cpp": implements the struct "B.h": declares the function "B.cpp": implements the function, error here
I think making the instance (inst) a reference might solve this. But the instance is assigned to a return value from a function (returnFunc). Like:
void theFunction() { ... theClass::theStruct inst = returnFunc(...); //returnFunc() returns an instance of theStruct //the error is at 'inst' ... }
I'm going from section 7.1 where it is stated that:
Standard wrote:A declaration occurs in a scope (3.3); the scope rules are summarized in 3.4. A declaration that declares a function or defines a class, namespace, template, or function also has one or more scopes nested within it.
Jumping to section 3.3 we find that there exist block scope, function prototype scope, function scope, namespace scope, class scope, enumeration scope, and template parameter scope.
I find nothing that states that static_assert declarations cannot be used in any of those scopes, yet only block, function, class, and namespace scopes allow for it with clang.
static_assert(true, "");// namespace scope (good)) class X { static_assert(true, "");// class scope (good))
void f(std::vector<int> const &v, std::vector<int>::const_iterator it = v.end()) { } int main() { f({}); } prog.cpp:4:73: error: local variable ‘v’ may not appear in this context void f(std::vector<int> const &v, std::vector<int>::const_iterator it = v.end())
Why is this not allowed? (I mean, what is the reasoning for defining the standard this way?)
In C++14/C++17 we will have a unified way to represent end iterators without an instance of the container, but currently I just have to hope my implementation accepts a default-constructed iterator as an end iterator.