|
and if this is not enough (for example if you have no access to the source code of your target instance), you can define a Type descriptor that will filter the unwanted properties. See this article[^].
|
|
|
|
|
con.Open();
object[] objArrRestrict;
//select just TABLE in the Object array of restrictions.
//Remove TABLE and insert Null to see tables, views, and other objects.
objArrRestrict = new object[] {null, null, null, "TABLE"};
DataTable schemaTbl;
schemaTbl = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,objArrRestrict);
// Display the table name from each row in the schema
foreach (DataRow row in schemaTbl.Rows)
{
listBox.Items.Add(row["TABLE_NAME"]);
}
instead of using list box,i want to add tables to tree veiw
what can i do???????????/
chanzeb chaudhary
|
|
|
|
|
use treeview1.nodes[0].add()....but a treeview can have child nodes recursively so how do you want to show the obtained rows in treeview ?
Koushik
|
|
|
|
|
int i = 0;
foreach (DataRow row in tbs.Rows)
{
treeVu1.Nodes[i].Add(row["TABLE_NAME"]);
i = i + 1;
}
But it does not work.
ERROR Message "Cannot apply indexing with [] to an expression of type 'method group"
|
|
|
|
|
hey use the following...
foreach (DataRow row in tbs.Rows)
{
treeVu1.Nodes.Add(row["TABLE_NAME"].ToString());
}
Koushik
|
|
|
|
|
|
hey guyz..im having a problem about my application, it has a profile form, with picture, this picture is being converted to bytes and save it to database, when the form loads, it will create a temporary file..and display the picture.. but the problem here is that, whenever i changed the picture of a certain profile, it will still displays the previous one, because the "file is being used". I can't see the effect, unless i stop the application and run it again.. i hope you can help me with this..tnx in advance
some codes:
strfn = AppDomain.CurrentDomain.BaseDirectory + "profile_pic\\" + dgProfile[dgProfile.CurrentRowIndex,0].ToString();
FileStream fs = new FileStream(strfn,FileMode.Create,FileAccess.Write);
fs.Write(imageByte,0,imageByte.Length);
fs.Flush();
fs.Close();
picBoxProfile.Image = Image.FromFile(strfn);
|
|
|
|
|
How do you read the bitmap ? If you pass the path to the constructor, this is what's holding the file open.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Image.FromFile() is known to lock the file for as long as the image is alive;
I suggest you try and use Image.FromStream() instead. The stream you use can be
a FileStream, but it can also be a MemoryStream, so maybe you don't need a file at all.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi all,
Is there any way, given an item in a dictionary D, to find its key(s), besides iterating through it? Would using another data structure helps if so which? (I seem to recall a solution for C++, but I can't definitely remember it and not sure if it applies to C#)
Thanks in advance!
|
|
|
|
|
You basically build two dictionaries, one in each direction. I think there are C++ classes that do a bidirectional hash table.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I am creating TabPages dynamically, adding a few textboxes, buttons etc.
I can't figure out though how to access these controls. I tried:
foreach (TabPage tp in tabControl1.TabPages)
{
foreach (Control c in tp)
{
if (c is CheckBox)
{
if (c.Enabled == true)
MessageBox.Show ("Enabled");
}
}
}
but get the error that TabPage does not contain a definition for GetEnumerator().
As the controls are created dynamically, I can't access them by name in the code.
Any ideas on how to access these controls?
-- modified at 4:06 Thursday 11th October, 2007
|
|
|
|
|
That sounds odd, I would have thought what you're doing is fine.
Try changing the outer loop from a foreach to a standard for loop. The implication is that the TabPages collection does not implement IEnumerable.
Regards,
Rob Philpott.
|
|
|
|
|
we can do like the following one...
foreach (TabPage tp in tabControl1.TabPages)
{
for (int i = 0; i < tp.Controls.Count;i++)
{
if (tp.Controls[0] is CheckBox)
{
if(((CheckBox)(tp.Controls[0])).Enabled)
MessageBox.Show ("Enabled");
}
}
}
Koushik
|
|
|
|
|
oh yes, just spotted it.
its this :
foreach (Control c in tp)
should be;
foreach (Control c in tp.Controls) or something like that. Can't remember what the collection is called.
Regards,
Rob Philpott.
|
|
|
|
|
Thanks guys, the
foreach (Control c in tp.Controls) was what I needed.
|
|
|
|
|
hi all,
can an object created for abstract class and interface?
can i use a static method in abstract class?
if i am using all methobs in abstract class as abstract method then how it vary from interface.why cannot i use an interface instead.
ganesh
|
|
|
|
|
Interface is like a contract that defines the structure of a class.
if a class implement that interfac it would have to do all that it singed at the "contract"
thungs that can be defirnd in an interface :
Methods
Indexers
Events
no :
Data members
Static
Constructor / destructor
no private / public before methods
have a nice day
p.s:
if we did not had abstact/interface
things would go and messy as they where
kobkob
|
|
|
|
|
kobibi wrote: Static
I really dont like it. I have a plenty of classes implementing ICorrector interface, which have not any fields - they are expected to have a static method which would validate some user's input. But instead I have to create an instance of a class to call this validate method
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
Ganesh RV wrote: can i use a static method in abstract class?
Yes
Ganesh RV wrote: if i am using all methobs in abstract class as abstract method then how it vary from interface
It doesn't, except that the abstract class can define the method(s) as protected.
Ganesh RV wrote: why cannot i use an interface instead
You can, except with the interface you don't define an access modifier (public/private/internal/protected)
|
|
|
|
|
Please post your question in one place only. I answered this in the VB forum, are you using VB or C# ? I know the answer is the same, but it's rude to cross post.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Ganesh RV wrote: if i am using all methobs in abstract class as abstract method then how it vary from interface.why cannot i use an interface instead.
You can.
One big difference between interface and abstract class is that once you publish interface, you can't change it. When you publish abstract class, you can add members in next version without breaking anything. That's not possible with interface.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
hi
How to split or divide a single word document into multiple word documents using c#.
Note: i have Microsoft word 2000.
Nitin Raj Bidkikar
|
|
|
|
|
You could probably do some kind of Office Interop trick by creating individual files by reading in the original file...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Why it is so diffcuilt to set an set an environmet variable in C# ?
I have one program from Microsoft KB 829145 which set it but if you come out of process then it again reset. so from My computer-->Properties-->Advanced-->Environment variable-->System variables i never can see that updated value .
Sample from Microsoft site http://support.microsoft.com/kb/829145
did it but it dose not retains once you out of the process.
i did lot of search and found many are using WMI, registry functions but why microsost made it so diffcuilt to set it?
Why System.environmet class SetEnvuironmentVariable method not working ?
Is any simple program which will update the system environmet variable and retain the same value after process exits ?
Go to My computer-->Properties-->Advanced-->Environment variable-->System variables and there i must able to see the new updatred value.
|
|
|
|