|
How can I add a type derived from DataGridColumnStyle into the list in the DataGridColumnStyle Collection Editor dialog box (of the Properties dialog box)?
|
|
|
|
|
I have a contextmenu which I use & for charachter to set shortcut for users. Foe example it has a "&Hello" test.The problem is an underline is shown in design mode under 'H' , but at run time it does not appear.The event habdler fires when I press H but there is no underlinw at run time.Any idea?
Mazy
No sig. available now.
|
|
|
|
|
You might have Windows' setting turned on where it doesn't show the accelerator letters unless you press Alt. An easy way to tell is to put a MainMenu on your form and do the same thing. If at runtime you don't see the accelerator letters then you know this is the case. Press Alt to bring up the menu and then they'll be there.
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Oh ya.When I press Alt they apear. Where is this setting in windows?
Mazy
No sig. available now.
|
|
|
|
|
On WinXP Pro it's located under Display Properties, Appearance tab, Effects... button, uncheck "Hide underlined letters for keyboard navigation until I press the Alt key".
James
At Jethro Tull's August 28, 2003 concert Ian Anderson mentioned that the group would be performing a medley of title tracks. The songs were "Songs from the Wood", "Too Old to Rock and Roll; Too Young to Die"; and from the Heavy Horses album, "Stairway to Heaven".
|
|
|
|
|
Thanks James.
Mazy
No sig. available now.
|
|
|
|
|
Scenario:
Typed Tables Earnings, Projects, Adresses, Einheiten
DataSets: EarnSet (Earnings, Projects, Einheiten), ProjectSet(Projects)
For one Programm I need the Tables Earnings and Projects in one DataSet. For another Programm I need just the Table Projects. The Status is that now I have two DataSets: EarnSet with Earnings and Projects Tables and ProjectSet with only the Projects Table. So I have the same table-Definition in two different DataSets.
Is there a way to add the typed Table Projects from ProjectSet to the typed DataSet EarnSet so that after in the EarnSet the typed! Table Projects exists?
Stefan
|
|
|
|
|
1. I think it's impossible to have one table into two datasets
2. Try to use one dataset or copy table with data
Hi,
AW
|
|
|
|
|
i have a number of projects located within my solution (they are dlls (3)) i reference the project from my main project,and when the dlls are compiled they are put in the directory with the .exe the program works fine...but i want to move those dlls to a diffrent sub folder (/data or something you know ?) but the .exe cant locate them if i move them. How can i move them and still have the .exe locate them ?
thanks for your time.
Jesse M.
The Code Project Is Your Friend...
|
|
|
|
|
I see people doing this with VB, but I can't get it to work in C#.
<br />
System.Drawing.Imaging.ImageCodecInfo myImageCodecInfo;<br />
System.Drawing.Imaging.Encoder myEncoder;<br />
System.Drawing.Imaging.EncoderParameter myEncoderParameter;<br />
System.Drawing.Imaging.EncoderParameters myEncoderParameters;<br />
<br />
myImageCodecInfo = GetEncoderInfo("image/tiff");<br />
<br />
myEncoder = new System.Drawing.Imaging.Encoder(System.Drawing.Imaging.Encoder.Compression.Guid);<br />
<br />
myEncoderParameters = new System.Drawing.Imaging.EncoderParameters(1);<br />
<br />
myEncoderParameter = new System.Drawing.Imaging.EncoderParameter(myEncoder,<br />
:confused:System.Drawing.Imaging.EncoderValue.CompressionCCITT3<br />
);<br />
<br />
myEncoderParameters.Param[0] = myEncoderParameter;<br />
DestBitmap.Save(strFileName, myImageCodecInfo, myEncoderParameters);
The compiler insists that it doesn't know how to convert CompressionCCITT3 to byte . I don't know why EncoderValue isn't one of the overloads in the first place. If I manually cast it as byte, int, or long, I get an invalid parameter error from save. Does anybody know which one of the 16 overloads I'm supposed to use?
|
|
|
|
|
I apparently lost track of all my permutations. byte, short, and int all result in "invalid parameter" from save, but long appears to work. I almost forgot that the int and long are the same thing in mc++ but not c#.
Thanks anyway.
|
|
|
|
|
I have a datagrid, dataset, and sql server data source. I would like to be able to update my dataset through my datagrid. I thought binding the dataset to the datagrid would give me the ability to do this, but I guess I am wrong (I am new to C# and .NET). I have created a dataAdapter to update the datasource, but I would like to update the dataset first. Can any one help me get started here. What I have is a datagrid and would like to allow the user to do update, insert, and delete data then click a button that will sync the datagrid with the dataset. Any insight is appreciated.
|
|
|
|
|
Binding a Control to a DataTable or DataSet adjusts only Data in the DataSet NOT in the SQL-Server Table. That means that your input in your Datagrid will only change Data in the DataSet. You have to Update the Tables with the DataAdapter.Update(DataTable) / SqlDataAdapter.Update(...) Method.
So your Button to Update: SqlDataAdapter.Update(DataTable) /DataSet
DataTable dt=new DataTable("Table1");
..
..
SqlDataAdapter ada=new SqlDataAdapter(...);
ada.Update(dt);
Be aware of not to call DataSet.AcceptChanges/DataTable.AcceptChanges() before DataAdapter.Update()! because otherwise no data will be updated; after AcceptChanges all Rows are marked as unchanged and so the DataAdapter don't "find" Rows to Update! In the help files everywhere you can find
"AcceptChanges()" which is very irritating.
|
|
|
|
|
Thanks for the response, but I realize that binding a control to a dataset will only update the dataset. The problem is after i bind to the control and update the datagrid.....the data in the dataset is not being modified. is there any code i need to implement to get the dataset updaated with the the data the user has modified in the datagrid?
|
|
|
|
|
Now I think I understand your question:
You modify data in the datagrid by typing in some new text, numbers...but the datasets data isn'nt changed which has nothing to do with the Sql-Server side datatables.
If a Control is bound to a dataset, the datasets data is changed when the user changes data in the control at once. That means that your binding code may be wrong. Would you like to show me your binding code?
|
|
|
|
|
Here is the code for my data binding. The form has a datagrid and two drop down lists. One of the lists allows the user to choose the table to modify and click a button to retrieve the data in that table. Therefore, when the form initially loads, I only bind it to the dataset and not a particular datatable. After the user chooses a datatable from the drop down list, I have an event handler that updates the data binding. Thanks for any help.
The code below is the initial data binding where the control is bound to only a dataset:
this.dataGrid1.SetDataBinding(todv.dvm, null)
I call another object that creates and manipulates a dataviewmanager (todv). todv.Filterview returns a dataview. So in this case, I bind to a dataview.
The event handler to update the databinding:
private void retrieveBtn_Click(object sender, System.EventArgs e)
{
string selectedItem = comboBox1.SelectedItem.ToString();
DataView dvm2 = todv.FilterView(comboBox2.Text.ToString(),comboBox1.Text.ToString());
dataGrid1.SetDataBinding(dvm2, null);
}
|
|
|
|
|
I think that dataGrid1.SetDataBinding(dvm2, null); is wrong.
try:
dataGrid1.DataSource=dvm2;
What method is FilterView?
|
|
|
|
|
STW wrote:
try:
dataGrid1.DataSource=dvm2;
This is not possible as the DataSource property takes a string. Tried different ways to assign dvm2 to DataSource but did not work.
STW wrote:
dataGrid1.SetDataBinding(dvm2, null);
But this is working. I guess the question is, if I bind to a dataview and then make changes to data through the datagrid will the underlying datatable be modified as well. It seems like it should.
Here is the FilterView method. It just simply adds a filter on dataset:
public DataView FilterView(string dataTable, string filter)
{
DataView newView = dvm.CreateDataView(tom.tradarOmsMapping.Tables[dataTable]);
newView.RowFilter = "Oms like '"+filter+"'";
return newView;
}
|
|
|
|
|
No, the DataSource Property of a DataGrid needs an object which can be DataSet, DataTable, DataView.
So now I think now I understand your question.
Yes, all changes made in a datagrid will change the underlying DataTable, View. When you then Update via an DataAdapter, the new data will be written to the Sql-Table. The DataGrid is synchronised with the Table, View.
But now I'm not anymore sure if I understood your problems with the grid.
1. When you change your two lists is the correct Data shown in the DataGrid?
2. When you changed Data by writing in the DataGrid and update it, is the new Data written to the Sql-Server?
If you answer the two question with Yes I don't understand the problem.
|
|
|
|
|
No, DataGrid.DataSource needs an object which can be a DataSet, Table, View, ...You can read this in the help.
Yes, the DataGrid is "equal" to the Table. When you change Data in the Grid, the Table will change at once, too.
Two questions:
1. When you make changes to the two lists you have, is the correct Data shown in the Grid?
2. When you Update the Tables, DataSet is the new data written to Sql-Server?
|
|
|
|
|
Hi,
I have a client window (in a MDI app) with lot of controls - listboxes, buttons, pictureboxes, etc - on it. I want to show a scaled-down version of the window i.e. show a window 1/8th size of the original window with all the controls on it.
Is there a way to scale down the controls?
Something like:
Form newForm = new Form();
newForm.size = OriginalForm.size/8;
for(i = 0; i < controlsOnOriginalForm; i++)
{
// Get control from original form
// create same control, size it and put on the new form
}
Any suggestions / help would be appreciated.
Thanks,
Suhas
|
|
|
|
|
I don't think that there exists a "Scale" Methode for this problem.
But I see that your code above is the solution for your problem. You just have to iterate through the Controls, resize them and set the right position. Perhaps you'll find a good common method for this. Maybe the Anchor property of a Control helps you.
Perhaps this may help too:
Array a=new ArrayList();
this.form.Controls.CopyTo(a,0) //Copies the Controls to an array
Form f=new Form();
foreach(object o in a)
{
Control ctrl=(Control)o; //get the control
ctrl=this.RecalcControl(ctrl) //Common Method to fix size and location
f.Controls.Add(ctrl);
}
void RecalcControl(Control ctrl)
{
ctrl.Size=..
ctrl.Location=..
return ctrl;
}
Your problem will be a good education for C#
Good luck
Stefan W.
|
|
|
|
|
Ive been working with VC++ for a while and want to begin to learn C#.
Can anyone recommend a good book to learn C#?
Thanx for the help,
-Flack
|
|
|
|
|
I was new to programming when I decided to pick up C# -- Deitel & Deitel 'How to learn C#' was my first book but in reflection its not the best. I once borrowed a MS Press C# book which was way more usefull but I cant remember the title (posibly Inside C#). I guess I was looking for more about programming than just syntax... happy hunting and let us know what you find usefull.
gadgetfbi@hotmail.com
|
|
|
|
|
First of all, you need to learn C#, so go with
Inside C# 2nd Edition by Tom Archer (MSPress)
Immediately afterwards, read either one of these:
Applied .NET Framework Programming by Jeffrey Richter (MSPress)
Essential .NET by Don Box(Addison Wesley)
I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well.
-jhaga on non-native languages
|
|
|
|