|
It throws that exception probably because you don't have a table in the dataset called Location . You might want to check for it before you try to get the Rows collection out of it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ProjectSetup_Load is called after the constructor, so there is no table Location in your dataset and the exception is thrown.
www.troschuetz.de
|
|
|
|
|
Thank you, I already figured that out with print statements.
I really apreciate the help.
|
|
|
|
|
Help is what we are there for
And it's good to here that you didn't only wait for an answer, but figured out the problem yourself.
www.troschuetz.de
|
|
|
|
|
Hi guys, first time posting.
I have a project with a windows form client, and a class library. in the main form I instantiate the gallery class like this:
Gallery cgsGal = new Gallery();
ok, so that's all find and dandy.
now, i have another form which sells an art piece from the gallery. if i instantiate another Gallery instance on the second form it doesn't find my collection to iterate through to find the Art Piece to sell.
How do I use the instance of gallery from the the first form, on the second form?
I feel I should know this. I can't find anything in my book (Beginning Visual C#, Karli Watson Et Al) about it. If someone could lend a hand (or a brain) I'd be very thankful.
Bryan.
|
|
|
|
|
I'm not a .net guru but...
you could declare your collection in your Galley class as static
www.lovethosetrains.com
|
|
|
|
|
Expose a property that returns the cgsGal object. Something like
class FirstForm : Form
{
private Gallery cgsGal = new Gallery();
public Gallery Gallery
{
get { return cgsGal; }
}
}
class SecondForm : Form
{
public void SomeMethod()
{
Gallery g = firstForm.Gallery;
}
}
You need to have a reference to FirstForm from within SecondForm, which you can do by passing it as a constructor parameter to SecondForm.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello fellows
I have a strange problem:
I'm calling a method called DrawXorCircle in my C# application.
When I pass the graphics object of my PaintEventArgs to my Graphics object, appears the following error: "Out of Memory"
In the form class I've create a Draw variable, that I assign to the object "Desenho", created in my form's Paint event
What is happening? Thanks a lot for help
Below, my code:
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Draw Desenho = new Draw(e);
Reta = Desenho;
}
public class Draw
{
Pen pColor = new Pen(Color.Blue);
private PaintEventArgs pDes;
public Draw(PaintEventArgs e)
{
pDes = e;
}
public void DrawXorCircle(string sCoordinate)
{
Graphics g = pDes.Graphics;
int iPos = sCoordinate.IndexOf(",");
int iX = int.Parse((sCoordinate.Substring(0,iPos-1)));
int iY = int.Parse((sCoordinate.Remove(0, int.Parse(sCoordinate.Substring(0, iPos)))));
Point p1 = new Point(iX, iY);
Point p2 = new Point(iX+4, iY+4);
g.DrawLine(pColor,p1,p2);
}
}
|
|
|
|
|
|
I called this guy in my KeyPressEventHandler. I'm at work, so I don't put the code in here. I will write the code searching in my head, so sorry if the code doesn't be ok:
protected void KeyPressEventHandler(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(Connexion.Text != null & e.KeyCode == Keys.Enter)
{
Reta.DrawXorCircle(Connexion.Text);
}
}
well, the code it seems with this guy.
Thanks man to aswer my question.
|
|
|
|
|
|
The place where I Draw is in my form, not in a Bitmap. And because is in the form, my code(I think) is correct.
|
|
|
|
|
No, it's not correct.
You store a reference to the graphics object in the draw event, but that is useless once the draw event has ended. You can't use it from the keypress event.
Also, you shouldn't just draw things on the screen. The proper way to do this is to store where you want your graphics drawn, and invalidate the control where you want it drawn, so that new draw events are executed that can draw the graphics. The graphics object that you get in the draw event is clipped and ready to draw exactly the area that is needed so that you don't draw on other windows that might partly overlap your window.
---
b { font-weight: normal; }
|
|
|
|
|
thanks man, I understood, thanks to you and leppie
|
|
|
|
|
thanks man, I understood, thanks to you and Guffa
|
|
|
|
|
How can I access S.M.A.R.T. information and how can I turn it on on disks that do not have it on?
Sorry for asking this, but I googled the hell of it and came home empty
Thanks in advance for any help.
Bernardo Heynemann
Lead Developer / Architect for Core Tech Brazil
|
|
|
|
|
|
I'm sorry, i meant using C#. I thought it was implicit because of the board I posted in.
Bernardo Heynemann
Lead Developer / Architect for Core Tech Brazil
|
|
|
|
|
Hello,
How do I delete multiple elements from collection (array) at once?
I'd like to do that by index.
For example, I want to delete elements with indexes 1, 2, 3 and 4.
If I delete element at index 1, all elements and their indexes will be shifted. That's the problem. I need to delete the elements in compact index section, like: 1,2,3,4 or 7,8,9,10.
Thank you in advance
Goran
|
|
|
|
|
|
Ok. Thanks.
But, how can I do that manually?
|
|
|
|
|
Iterate through the collection and add the elements you need to delete to another collection. Then iterate over the other collection, calling Remove on the first collection. This is because you'll get a runtime exception if you delete items from the collection on which you are iterating on.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
This is the easiest way (pseudocode):
<br />
for(Int32 i = col.Count - 1; i >=0; i--)<br />
if (ShouldRemove(i))<br />
col.Remove[i];<br />
This way, the lower collection elements are not affected by the deletions of the higher indexes.
Sean
|
|
|
|
|
Is the functionality of these cool looking Docking Windows integrated in the .NET Framework 2.0?
I wonder why it is used in the MSDN Library and in the Visual Studio 2005 (MSDN Library and Visual Studio 2005) while I didn't find it as a usable component of framework 2.0. Also this way of arranging all the tool windows looks very nice (example)but this doesn't seem to be available either.
I looked through the net and found several self-made docking panels but I'm still searching for the original ones made by Microsoft as used in Visual Studio. Are they available by some ways or not?
|
|
|
|
|
Hi,
i am trying to add a com component in C# but the component is not been able to add, i.e. when i try to add, following error is displayed
"Add reference: error adding reference to project"
for additional info, i have a sample sdk that is using the component it is actually developed under VC 6.0 and is using .idl files
is it possible to use this component in C# if possible how,
i am also trying to add the same component in VC(managed)windows component but the problem is still the same
Will some body help me, i will be very thankfull.
Arus.
|
|
|
|