|
What exactly is the point of enumerating GAC assemblies? It's not like VS will let you add references to assemblies that are sitting in the GAC.
|
|
|
|
|
See ExecuteCommand Method (DTE Object). You'll want "Project.AddReference", I think...
DTE.ExecuteCommand("Project.AddReference", "");
Try it in the immediate window by typing "Project.AddReference" It'll bring up your requested dialog.
Ian Mariano - Bliki | Blog
"We are all wave equations in the information matrix of the universe" - me
|
|
|
|
|
Nifty...never screwed much with the Command Window. Nice to know what it can do.
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
The following doesn't seem to work...
foreach (Form f in this.MdiChildren)
{
f.Close();
}
I recieve the following error "Specified cast is not valid."
Am I missing something.
Sweet
|
|
|
|
|
You can't change a collection while enumerating it. Calling Close ultimately will change the collection. Instead, use:
for (int i=0; i<MdiChildren; i++)
{
Form f = (Form)MdiChildren[i];
f.Close();
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Right now comes the this. I've got 3 mdichildren forms and when I click the button to close all the forms, only 2 closes and 1 stays open until I click the button again. Is it because I did the following like u showed except I added .Length.
for (int i = 0; i < MdiChildren.Length; i++)
{
Form f = (Form)MdiChildren[i];
f.Close();
}
Sweet
|
|
|
|
|
Sorry - I made a mistake. You should either run through the array backward or make a copy of the array (and forgetting .Length was a typo - it's only sample code):
for (int i=MdiChildren.Length; i >= 0; i--)
{
Form f = MdiChildren[i];
f.Close();
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks it works. All I had to do is add the - 1
for (int i = MdiChildren.Length - 1; i >= 0; i--)
{
Form f = MdiChildren[i];
f.Close();
}
The Author of the book I'm reading should revise his book.
My brain is 2 small for all the knowledge that I need.
|
|
|
|
|
You were real close, here is my CloseAllChildren process for my MDIParent:
private void CloseAllChildren()
{
System.Windows.Forms.Form[] myChildren = this.MdiChildren;
foreach (Form child in myChildren)
{
child.Close();
}
return;
}
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Hi everyone.
Could anyone give me a few pointers on how to write a writepixel method with directx for .NET please?
Thanks.
|
|
|
|
|
Without going into too much detail, it's not quite that easy. There are two ways to do what you're talking about. One is blitting a one pixel blob to the location specified. The other involves locking the surface buffer, and then using the desired coordinates (x,y) and the stride of the surface (# of bytes/scan line) to determine the offset needed to set.
Kinda like this: (not compilable code)
WritePixel(Surface surf, int x, int y, int col) {
int[] surfaceContents = surf.Lock(....);
int offset = (y * surf.width * surf.SurfaceDescription.Stride) + x;
surfaceContents[offset] = col;
surf.Unlock();
}
You're better off searching thru Google about the actual formula involving X, Y, and stride. I can't remember exactly where the stride fits in at this second.
Good luck
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
Hello again.
This is how I now try to do it
public void WritePixel(int color,int x, int y)
{
Array surfaceContents = _surface.Lock(LockFlags.SurfaceMemoryPointer);
int offset = ( x ) + ( _surface.SurfaceDescription.Pitch * y);
surfaceContents.SetValue(color,offset);
_surface.Unlock(null);
}
However I get an error that says lock doesn't return Array, although that it is what is stated in the ms documentation. Is this a bug or am I just doing things the wrong way?
Thanks.
|
|
|
|
|
It's of *type* Array, but think of it more as an Array of *something*.
As in:
Array == int[], or byte[,], etc.
Actually, if memory serves, Surface.Lock actually returns a 2D byte array, but my memory sucks, so check through Google to make sure.
If I'm right:
byte[,] surfaceContents = Surface.Lock(LockFlags.SurfaceMemoryPointer);
Good luck
Jeremy Kimball
I have traveled the gutters, lo these many days, with no signs of life. Well met.
-brianwelsch
|
|
|
|
|
I have a Custom Collection based on IList, so I can bind it to a datagrid. But if I change an item in the collection the information on the grid doesn't change.
How can I get this to work, like the dataset databinding works? If I update an item in a datatable in a dataset the grid gets updated instantly.
"Every rule in a world of bits and bytes can be bend or eventually be broken"
|
|
|
|
|
|
Hi all,
I have seen lots of articles on the subject of datagrid controls and check boxes. I am currently designing a goods movement system for the company i work for and i have most of it finished. However, on the last page i want to display a datagrid control with data that has been entered on previous pages, that bit i have done including formatting the datagrid (which took some figuring out but i got there in the end).
The user will have to go through each entry every week and tick them off one by one. I have added a DataGridBoolColumn object to the TableStyle.GridColumnStyles collection and the check box displays fine. However i have 2 problems.
1. The default value for the check boxes is true, i need it to be false and setting the value to false when setting up the column in code doesn't work. Although by answering the next question this might be solved.
2. Whenever i tick/untick the box then move the focus away from the cell in the grid the checkbox returns to a checked state.
any help that you can give me would be appreciated.
Cheers
KP
|
|
|
|
|
You don't have it bound to a data column correctly. The default value only applies when the data the column is bound to doesn't already have a value. Likewise, if it's not bound correctly it always appears checked.
Read the documentation for the DataGrid.DataSource and DataGrid.DataMember properties about binding data - any IList or IListSource implementation like a DataSet or DataTable - to the DataGrid , as well as the DataGrid.TableStyles about how to apply table styles to a particular data source.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
thanks for your advice but i have already bound the DataGrid to a DataSet
dataSAR.DataSource = gmb.gmbSet;
dataSAR.DataMember = "SAR";
Then i set up a DataGridTableStyle , mapped it to the table.
DataGridTableStyle sarStyle = new DataGridTableStyle();<br />
sarStyle.MappingName = "SAR";
Next i created a DataGridBoolColumn object and mapped it to the corresponding column in the table
DataGridBoolColumn checkColumn = new DataGridBoolColumn();<br />
checkColumn.MappingName = "Checked";
Finally i added the column to the TableStyle and added the TableStyle to the DataGrid.TableStyles collection.
sarStyle.GridColumnStyles.Add(checkColumn);<br />
dataSAR.TableStyles.Add(sarStyle);
I think that this is the correct way of going about this but i am having the problems mentioned in the above post so any advice about what i am doing wrong would be appreciated.
Cheers
KP
|
|
|
|
|
Make sure the TrueValue and FalseValue properties are set to whatever you use for true and false values. These values are case-sensitive.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How would that affect me checking / unchecking the check box at runtime? When i uncheck the box at runtime, as soon as the focus goes to another part of the form the box is checked again.
KP
|
|
|
|
|
It's called data-binding. Controls are bound to data, which is updated when the control is changed and vice versa. If the true/false values are not the same for both, the value can't be bound.
Read the class documentation for the DataGridBoolColumn in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
I have set the default true/false values for the DataGridBoolColumn to lower case true and false so that they match with the Value applied when a check box is checked / unchecked and it appears to work.
Thanks for all your help, i really don't think i would have figured this one out by myself.
KP
|
|
|
|
|
Hi all,
I have seen lots of articles on the subject of datagrid controls and check boxes. I am currently designing a goods movement system for the company i work for and i have most of it finished. However, on the last page i want to display a datagrid control with data that has been entered on previous pages, that bit i have done including formatting the datagrid (which took some figuring out but i got there in the end).
The user will have to go through each entry every week and tick them off one by one. I have added a DataGridBoolColumn object to the TableStyle.GridColumnStyles collection and the check box displays fine. However i have 2 problems.
1. The default value for the check boxes is true, i need it to be false and setting the value to false when setting up the column in code doesn't work. Although by answering the next question this might be solved.
2. Whenever i tick/untick the box then move the focus away from the cell in the grid the checkbox returns to a checked state.
any help that you can give me would be appreciated.
Cheers
KP
|
|
|
|
|
i have some questions regarding thread termination. i am giving a user the ability to stop a test case (thread) at any given time. my test cases have tendencies to be in long blocking states (eg, long I/O, or just waiting up to an hour for a certain response). i want the user to be able to abort out of these states. what is the best way? if i carefully clean up everything in the ThreadAbortException catch clause, is it considered OK to explicitly call Thread.Abort on the thread? or should i opt for the passing in of a manualresetevent and checking at the top of the loop, and if in blocked state use thread.interrupt instead?
|
|
|
|
|
Close the resource that the I/O is blocking on. That should unblock the thread and an error condition should also exsist that you can use logically to determine that you need to exit the thread.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|