|
Thanks for your help.
John Acton
|
|
|
|
|
|
|
I have table1 which has the columns:
A,B,C,D,E
I have table2 which has the columns:
E,F
My end result is that I want to only export the data from table1 - Column E
I could go through a foreach loop for each row on table1 and if it exists on table2, then write it out, but is there a quicker way to do this ?
Thank you
|
|
|
|
|
Where are the tables ? You can get the list of items using a simple SQL statement.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
The columns we are interested in are from a schema file, which is dumped into a datatable and these are the columns we need.
|
|
|
|
|
|
Is there an equivelant to the VB #import?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
What does #import do ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
sorry about that its the "imports" command. What i have is a class with a bunch of static methods. What i normally would do is something like this: ClassOne.MethodOne. Someone told me in VB you could use an "imports" command to import the entire class so you could just call the methods themselves without typing in the class name. Is there something like that out there like that for C#?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
No, that really sucks, and C# doesn't do it, AFAIK.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I must admit that I learned #import in C/C++ only. The equivalent in VB.NET is Imports, and the c# equivalent is using.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
In VB you are able to import a class instead of just a namespace. is there any way to do this in C#? I tried to import a class and it won't let me.
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
now why in the world would you want to "import" a class instead of a namespace?? That would make all of the fields of the "imported" class fields of the "importing" class. ...What you are describing is inheritance. Look here http://msdn.microsoft.com/library/en-us/vbls7/html/vbSpecStart.asp
Allowing what you are requesting would break object oriented design
(Nyquist Rate || ! Nyquist Rate)
{
Console.WriteLine("That is the question");
}
|
|
|
|
|
You can apply 'using' to a class if you use an alias:
e.g.,
using filealias = System.IO.File;
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter, VB to C++ converter
Instant Python: C# to Python converter, VB to Python converter
|
|
|
|
|
using is only for namespaces, not to bring a class into scope, or is it ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yes. You can do:
using System.Windows.Forms;
using Timer=System.Threading.Timer;
namespace xx {
class yy {
Timer timer=new Timer();
}
}
Luc Pattyn
|
|
|
|
|
Oh, I knew that. He wants to do this
using System.IO.Path;
class x
{
void somemethd(path)
{
string ext = GetExtension(path);
}
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
yeah basically i have a namespace called UVNET and i have a class called UniArray in that class has a bunch of static methods (one being called Extract) what Extract does is returns a string. Instead of doing
string myName = UniArray.Extract(someString, 2);
i would like to do
string myName = Extract(someString, 2);
a co-worker works with VB and said that instead of Importing just the namespace (i.e Imports UVNET) he can actually import the class also (i.e. Imports UVNET.UniArray) so he can just use the functions without calling the class over and over again. I was just wondering if there was a way that it was possible with C#. I mean its no big deal really it would just make the code look cleaner if i didn't have "UniArray" all over the place. This class has about 25 funcions that i use regularly and to me it would be easier if i could just type in the method itself
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Here[^] is a link to a screen capture i took while doing it in VB so you could see what's actually going on.
-- modified at 21:20 Monday 29th January, 2007
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
VB really sucks, and has a lot of hangover stuff from VB6. You're seeing some syntactic sugar here, that I don't think is supported in C#, and I'm kind of glad. the .NET framework is fully OO, creating these sort of globals is not really in keeping with how it should all work.
The equivelant statement is 'using', so if it works at all, then using MyNamespace.MyClass; is how it would work.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanks Christian for helping me get to the bottom of this. I had a feeling about this not possible i was just hoping i was overlooking something. Thanks again!
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
Good day everybody
There are cases on a form when the user might create a new row for example and not complete all the mandatory information as imposed by the database. In other words if you forget to enter data in a textbox binded to a datacolumn that does not allow nulls.
In that case if the user leaves the row somehow a NoNullAllowedException will be thrown. My problem is I am not sure what is the best way to handle this.
I thaught i could c,apture an event on the BindinSource but there is no "PositionChanging" event there is just a PositionChanged event, which of course is too late.
I could also take care of the case in the form itself but it seems like a lot of code for something that could be so simple.
Any suggestions?
Very confused
|
|
|
|
|
If you were using a DataGridView you'd be able to use the DataError event (I think that's the name) to capture it. You may have to handle it manually on a 'Save' )by checking a value isn't null before committing to the DataSet / DB) if you're using your own custom GUI for editing rows.
|
|
|
|
|
Hi @all!
I've got an amazing problem... or better a driving me crazy problem...
i have this code in print event...
StringFormat strFormat = new StringFormat();
strFormat.Trimming = StringTrimming.None;
strFormat.FormatFlags = StringFormatFlags.NoClip;
RectangleF InfoRect = new RectangleF(curXPos, nCounter, (e.MarginBounds.Right - CurXPos), newFont.Height);
e.Graphics.DrawString("Hello World! Test Text", newFont, brush, InfoRect, strFormat);
as anyone can see: newFont is a Font var, brush a brush, InfoRect a RectangleF and strFormat the StringFormat...
Ok, the problem now is quite simple... or for me not:
if the Text doesn't fit to InfoRect it's wrapped to next line... my problem is, how do i calculate the height of the needed space - especially the height - if it's not wrapped it's no problem, but when it's wrapped, i don't know how to get the height - i need the height to be calculated before the text is drawn by DrawString !!! i draw a rectangle around my text... so i need to know the height before... any suggestions??? Thank you!!! All ideas are welcome...
Ralf
FreewareFire is in the House!
|
|
|
|