|
Hi,
The MS PropertyGrid has not been designed to do that but you can still call the SelectedGridItem property to get the selected property, and then Parent property of the returned GridItem until GridItemType equals Root. Then, you can recursively parse the grid with the GridItems property of the GridItem class.
After that, the Value and PropertyDescriptor properties will help you compare the actual value with the default one.
I hope this helps.
Best regards,
Nicolas Cadilhac @ VisualHint
Smart PropertyGrid.Net
Microsoft PropertyGrid Resource List
Free PropertyGrid for MFC
Smart FieldPackEditor.Net / DateTimePicker
|
|
|
|
|
hi,
I am trying to get list of oracle servers running on network using c# but i am not able to do that.
But i can do same thing for SQL server so please tell me any solution on this.
thanks in advance
|
|
|
|
|
ganeshdpatil wrote: But i can do same thing for SQL server
How?
led mike
|
|
|
|
|
You can use Smo for this:
DataTable instances = SmoApplication.EnumAvailableSqlServers(false);
|
|
|
|
|
Sure but I wanted to know how he did it. I mean if he did using smo then obviously there is no Smo.EnumAvailbleOracleSevers() method so saying you can do it for SQL Server is pointless, if you used Smo.
Or am I missing something?
led mike
|
|
|
|
|
Sorry - I was in the middle of organising unit testers this afternoon so I wasn't really paying too much attention to the subtleties. There are other ways of evaluating SQL Server instances, but I've never heard of one for Orrible.
|
|
|
|
|
Pete O'Hanlon wrote: Sorry - I was in the middle of organising unit testers this afternoon
Damn you organazisers!
led mike
|
|
|
|
|
This wil help you get a list of SQLservers
just include using System.Data.Sql;
DataTable ListOfServersNames=new DataTable();<br />
var sqlServers = SqlDataSourceEnumerator.Instance;<br />
ListOfServersNames= sqlServers.GetDataSources();
Now the datatable will contain the list of servernames available.
I hope this solves your problem
|
|
|
|
|
This will return Sql server Instances not oracle instances.
But any way thanks for reply after long time.
|
|
|
|
|
Hey all,
I got borred of the windows locking screen so i tought i'd write my own system lock,
So i did with the use of a low level keyboard hook it works fine.
But when bashing allot of keys really fast a crash occurs, this happens in the call back of the keyboard but i dont have code for a call back in my code so VS tells me the crash occurs here:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); << here
}
Now i could simply try catch that line and in the catch do Application.Run(new Form1()); to restart it,
But i would rather have it just disregard the call back error and keep on running.
Is this possible to do?
|
|
|
|
|
Post the exception message, stack trace and any other information it gives you. The more info you give the more likely someone will know the answer.
(Also, what do you mean by "my own system lock", do you mean an app that runs full screen and you have to type a password to close it? or do you mean a GINA replacement for the windows ctrl+alt+del -> lock computer screen?)
Simon
|
|
|
|
|
If i can provide you with more info please tell me what you need and ill get it for you,
This is the null reference exception which is basicly the same problem the call back crash is harder to reproduce while running inside VS.
As you can see its a full screen type password sort of thing, every keystroke will show another message from my guardian ninja until the correct password is typed in. (mouse gets hidden and clipped)
As you can see it doesnt actually crash inside my forms code but outside it in the program.cs
http://img386.imageshack.us/img386/7118/crashap0.png[^]
|
|
|
|
|
Ok,
Add this line before just you call Application.Run
Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
And include these methods in your program.cs class
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
StreamWriter errorWriter = new StreamWriter(@"c:\errorlog.txt");
try
{
OutputError(e.Exception, errorWriter);
}
finally
{
errorWriter.Close();
}
}
private static void OutputError(Exception ex, StreamWriter errorWriter)
{
errorWriter.WriteLine("Type : " + ex.GetType().ToString());
errorWriter.WriteLine("Message : " + ex.Message);
errorWriter.WriteLine("Source : " + ex.Source);
errorWriter.WriteLine("StackTrace : " + ex.StackTrace);
errorWriter.WriteLine("TargetSite : " + ex.TargetSite);
errorWriter.WriteLine("Data :");
System.Collections.IDictionaryEnumerator enumerator = ex.Data.GetEnumerator();
while (enumerator.MoveNext())
{
errorWriter.WriteLine(" " + enumerator.Key.ToString() + " : " + enumerator.Value.ToString());
}
if (ex.InnerException != null)
{
errorWriter.WriteLine("");
errorWriter.WriteLine("Inner Exception :");
OutputError(ex.InnerException, errorWriter);
}
}
Get it to the crash again, and post the contents of the c:\errorlog.txt file that is produced.
No need to run it in visual studio, so you can create the exact circumstances of the error now.
Simon
|
|
|
|
|
So i added your code and using system.threading and IO.
Make it crash the null reference and the call back crash but not error file is produced.
I also did it in VS and your code just doesnt get fired :S
|
|
|
|
|
I use a modifyed version of your code:
I managed to get both crashes and got this result
Type : System.AccessViolationException
Message : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source : System.Windows.Forms
StackTrace : at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG& msg, HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Ninja.Program.Main() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Ninja\Ninja\Program.cs:line 27
TargetSite : Boolean PeekMessage(MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32)
Data :
Modifyed your code like this:
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Application_Exception);
private static void Application_Exception(object sender, UnhandledExceptionEventArgs e)
{
StreamWriter errorWriter = new StreamWriter(@"c:\errorlog2.txt");
try
{
OutputError((Exception)e.ExceptionObject, errorWriter);
}
finally
{
errorWriter.Close();
}
}
|
|
|
|
|
Ahh, nice one.
Are you doing something weird like kicking off a second message pump?
If you can stick your code up on line in a zip file somewhere, I'll take a proper look when I get home this evening.
Simon
|
|
|
|
|
Weird, did you defiantly put the event subscribe line _before_ the application.run line?
What I'm after is the full exception details, in particular, the stack trace. If you can get them yourself, just post them, if not, can you stick your code online somewhere in a zip file & I'll have a look when I get home.
Simon
|
|
|
|
|
|
I don't seem to have any emails.
Possibly not getting through the providers spam filter. (although I get all my CP emails fine). There's nothing in my spam folder.
Maybe try again?
Simon
|
|
|
|
|
Send a mail to scalee@gmail.com ill reply to it with my project attached
|
|
|
|
|
|
Hi
I have problem retriving data form Oracle DB.
I get "Object reference is not set to an instance of an object" error on line after //****
public override void Load(int id)
{
try
{
EROS2.Library.cDataHandle dh = new EROS2.Library.cDataHandle();
dh.Add("I_PK_CAMERA_ID", id.ToString(), EROS2.Library.ValueDataType.vInteger, EROS2.Library.DiretcionType.vInput, 0);
//****
DataTable dataTable = GetDataTableFromPackage("PKG_DCMS_CAMERA.PR_GET_CAMERA", dh);
if (dataTable != null && dataTable.Rows.Count == 1)
{
DataRow dr = dataTable.Rows[0];
LoadFromDS(dr);
}
}
catch (Exception ex)
{
TCSCore.TCSWindowsEventLog.LogException(ex);
}
}
here is rest of code involved:
public DataTable GetDataTableFromPackage(string packagename, EROS2.Library.cDataHandle parameters)
{
parameters.Add("o_cursor", "", EROS2.Library.ValueDataType.vCursor, EROS2.Library.DirectionType.vOutput, 0);
parameters.Add("o_return", "", EROS2.Library.ValueDataType.vInteger, EROS2.Library.DirectionType.vOutput, 0);
return m_Database.OracleConnection.GetDataTable(packagename, parameters);
}
and the store procedure:
----------------------------------------------------------------------------
procedure PR_GET_CAMERA(I_PK_CAMERA_ID in CAMERA.PK_CAMERA_ID%type, O_CURSOR OUT CursorType, O_RETURN OUT NUMBER) AS
err_num number;
err_msg varchar2(255);
proc_name CONSTANT VARCHAR(255) := 'PR_GET_CAMERA';
BEGIN
o_return := 1;
OPEN O_CURSOR FOR
SELECT CAMERA.*, CAMERA_STATUS.DESCRIPTION as CAMERA_STATUS, ADDEVICE.ADD_DESCRIPTION as ADD_DESCRIPTION,
ADDEVICE.PK_ADD_ID as PK_ADD_ID, ADDEVICE.ADD_CAM_TYPE as IS_MOBILE_TYPE
FROM CAMERA
JOIN ADDEVICE
ON ADDEVICE.PK_ADD_ID = CAMERA.FK_ADD_ID
JOIN CAMERA_STATUS
ON CAMERA.FK_CAMERA_STATUS_ID = CAMERA_STATUS.PK_CAMERA_STATUS_ID WHERE PK_CAMERA_ID = I_PK_CAMERA_ID;
o_return := 0;
EXCEPTION WHEN OTHERS THEN
o_return:= SQLCODE;
err_num := SQLCODE;
err_msg := 'SQLCODE: ' || SQLCODE || CHR(10) || err_msg || ':' ;
pr_store_error('Err', err_msg, err_num, proc_name);
END PR_GET_CAMERA;
----------------------------------------------------------------------------
I've checked and the id is passed properly to Load(), name of store proceduere is correct and the code works fine with different store procedures (id is different and name of procedure differs). SQL query similar to store procedure returns row without problem.
Whats wrong with it then?
|
|
|
|
|
Hi. I want to create a dialog which shows the progress of a file copy operation. I'll be copying a batch of files, some of which are up to 40Mb, so I want to display the current file progress aswell as the total progress. The problem I'm having is when I invoke the method for updating the UI. Because I want to update each for file I'm having to cycle through the source file byte by byte and then invoke the method which is using up all my memory. This is what I have so far. Any help would be appreciated.
FileCopyDialog.zip[^]
|
|
|
|
|
Maby its just me but what are you doing?
I see these totaly useless loops, why dont you just use File.ReadAllBytes and then write it out to file again and if you must have a byte by byte view. You can easily loop trough the byte array and write it out one by one.
And your why dont you just use the worker report progress function?
Well i hope this helps and maby i just dont get the picture.
|
|
|
|
|
Cheers for the reply. As I said, I need to display the current transfer progress for each file aswell as the total progress for all files so I need to write byte by byte (which it is doing) and then update the UI's progress bar with the current progress after each byte has been written. I'm not sure which loops you see as unnecessary btw as all 3 of them have a purpose. As for the workers' ProgressChanged event, it only has one value for percent complete and I need two.
modified on Wednesday, July 2, 2008 8:23 AM
|
|
|
|