Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
I

inyoursadachine

@inyoursadachine
About
Posts
17
Topics
13
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can you pass parameters to properties?
    I inyoursadachine

    Hi, A while back I was reading about passing parameters to C# properties and loving it. But I must have been dreaming because now (that I'm ready to use them) I can't find any mention of them. Was it only a dream? Thx, MAtt

    C# csharp question

  • Losing 1/2 my data in System.Collections.Queues ..
    I inyoursadachine

    Hi, I have a byte array of data that I store in to a Queue for processing reasons. But for some strange reason half of the data I put in the Queue (exactly the last half, actually, everytime!) dequeue as nulls (0x00). The sample output below shows the problem I'm having. The first two lines are a hex dump of my "input" byte array. The next line, "CreateQueue() done" tells me that the Queue was create and has the same size as the byte array (as it should). But in my double check you can see how the last 16 bytes are all null. Anybody know what's going on? Thx, Matt ----------------------------------------------------------------- 0000: ad 00 14 00 04 02 00 00 0a 4f 70 65 6e 53 65 72 0010: 76 65 72 05 00 00 00 fd 00 00 00 00 00 00 00 00 CreateQueue() done. matt=32, queue count=32 double check: 0000: ad 00 14 00 04 02 00 00 0a 4f 70 65 6e 53 65 72 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Here's the code that populates the Queue from the byte array: foreach(byte b in Pdu.Payload) { m_qPayload.Enqueue((byte)b); }

    Visual Basic data-structures help question

  • Exceptional Exceptions
    I inyoursadachine

    Thanks Dave. I was not aware that .NET wrapped each msg pump with an exception handler although that makes good sense. Is it possible to instruct (using your example of 2 forms, main and dialog) the dialog's wrapped exceptional handler to "hand off" caught exceptions back to the main form's code? TIA, Matt

    C# csharp graphics game-dev docker data-structures

  • Exceptional Exceptions
    I inyoursadachine

    Hi, My understanding of the way exception work in .NET is that once an exception is thrown, the run-time unwinds the call stack until either (a) the call stack is empty (game over) or... (b) a catch block is found that "handles" the thrown exception I tested this my understanding of this with the program below. And just as I thought it would, after level5() through the exception the Runtime unwound the call stack back to level1(). My understanding is that the objectless "catch" will catch -ALL- exceptions. Period. Even unmanaged exception one of my books says. So... if I define my static Main() as: static void Main() { try { Application.Run(new Form1()); } catch { MessageBox.Show("Not so fast!"); } } ... is it possible for an (some) execptions to "leak" out to the Runtime? Thanks, Cunfewsdish =============================================================== using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace Exceptional.cs { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // level1(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.Size = new System.Drawing.Size(300,300); this.Text = "Form1"; } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void level1() { try { level2(); } catch { MessageBox.Show("Kawt!", "Level 1"); }

    C# csharp graphics game-dev docker data-structures

  • Run Expect scripts from managed code
    I inyoursadachine

    Hi, I need to run an Expect script (Expect for Windows of course) from managed code. By "run a script" I mean link (dynamically load) the Tcl and Expect libs (DLLs), create a Tcl_Interp and pass it the script to run. At a high level what does this involve? Can I load (at runtime) the Tcl and Expect DLLs from "unsafe" code? What's the best way to do this? TIA, Matt

    C# tools question learning

  • Add a semi-colon (;) to the end of my select statement
    I inyoursadachine

    Hi, I'm making an OleDbConnection using the Sybase ASE OLE DB Provider with the following code: _____________________________________________________________________ OleDbConnection oDbConn = new OleDbConnection(sConnectionString); OleDbCommand oCmd = new OleDbCommand("SELECT * from master.table;", oDbConn); OleDbDataAdapter oData = new OleDbDataAdapter(oCmd.CommandText, oConn); DataTable oTable = new DataTable("master.table"); oData.Fill(oTable); __________________________________________________________________ The database I'm connecting to -requires- a semi-colon at the end of the SELECT command. I've tried ending my SELECT with a semi-colon (see above) but one of my OleDb objects is removing it before it is sent to the database as I can see the following databas error when running my program: SQL Parser: parse error at line 1. Command: SELECT * from master.table Issued by: How do I control the SQL statements sent to the database via the OleDbConnection so I can add a semi-colon to my SELECTs?? TIA, Matt

    Database database question com help

  • Active Directory & Multiple Connections
    I inyoursadachine

    I have a C# program the asks the user for a UserID, Password, and Domain and does a WinNT Active Directory query to return a list of groups the specified user belongs to. I start the program and enter user1/password 1 on domain 1 and it works just fine. But when I (in the same invocation) try to enter user2/password2 on domain 1 I get the following COM exception: "Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed....." I've tried closing and disposing the DirectoryEntry object after each use but to no avail. What do I have to do (close) to allow my program to do 2+ separate Active Directory queries for 2+ userid/password combos in the same invocation?? TIA, Matt

    C# csharp database com sysadmin windows-admin

  • enumerating groups a user belongs to using WinNT://
    I inyoursadachine

    Hi, How does one enumerate the groups a user belongs to using the WinNT:// provider (not LDAP) ?? TIA, Matt

    C# question

  • MSDASC.DataLinks PromptNew()
    I inyoursadachine

    Heath, You are the man! Thank You.

    C# question

  • MSDASC.DataLinks PromptNew()
    I inyoursadachine

    Hi, How do I create the IDataSourceLocator (hWnd) for my MSDASC.DataLinks object without first calling the PromptNew() method plus DialogResult.OK ?? I have a program where I want the user to be able to edit a connection string known (loaded) when the program starts. I want to be able to do something like this: private ADODB._Connection m_AdoDbConn; // then, create m_AdoDbConn without calling PromptNew() so I can do.. m_AdoDbConn.ConnectionString = sConnStrLoadedFromDisk; object o = (object) m_AdoDbConn; MSDASC.DataLinks oDlg = new MSDASC.DataLinksClass(); oDlg.PromptEdit(ref o); --------------- TIA, Matt

    C# question

  • DataGrid, Generic GDI+ errors, and a Big Red X
    I inyoursadachine

    Heath, Thank you for your assistance. I was aware (from a previous problem that you helped me with on CodeProject) the need for Control.Invoke and multiple threads. I was not aware that the asynchronous callback was implicitly its own thread althought this makes sense now. I do need to read "Including Asnych Calls" in .NET SDK... thanks for the link. @@@@ 1 More question @@@@@ I guess my job as a programmer is not to know at compile time which thread a given method is executing in and, hence, the need for InvokeRequired and Control.Invoke. Finally, my question. Why can't .NET make the "InvokeREquired" check for? Granted programmer's would get "generic" processing but then they could override the default .NET processing. Or am I missing something here? TIA, Matt

    C# help question winforms graphics data-structures

  • DataGrid, Generic GDI+ errors, and a Big Red X
    I inyoursadachine

    Heath, Thanks for your reply. Re: InvokeRequired; my program does not start any threads. My PeekCompletedHandler function is appended to the end of my post. Also, when I get the "Generic GDI+ exception" I don't see any specific info about the error in the MessageBox. How do I get that info so I can post it here? -Matt ============================================================= private static void MQPeekCompletedHandler(Object source, PeekCompletedEventArgs peekArgs) { MessageQueue mq = null; try { mq = (MessageQueue) source; if(mq == null) { MessageBox.Show("Source was null", "MQPeekCompletedHandler()"); return; } if(peekArgs.AsyncResult.IsCompleted == false) { MessageBox.Show("IsCompleted=false", "MQPeekCompletedHandler()"); return; } System.Messaging.Message msg = mq.EndPeek(peekArgs.AsyncResult); IceEvent oEvent = new IceEvent(mq, msg); if((oEvent.IsEventValid) && (s_nvcMsgsSeen[oEvent.Identifier] == null)) { s_nvcMsgsSeen[oEvent.Identifier] = "Y"; lock(s_MQEventQueue.SyncRoot) { s_MQEventQueue.Enqueue(oEvent); } } } catch(System.Messaging.MessageQueueException smmqe) { // The IOTimeouts occur because, as per the MS MSMQ Best Practices, we timeout our // Asnychronous BeginPeek() methods. if(smmqe.MessageQueueErrorCode != System.Messaging.MessageQueueErrorCode.IOTimeout) { throw new System.Exception("Unexpected MessageQueue exception", smmqe); } } catch(System.Exception se) { MessageBox.Show(se.GetType().ToString() + ": " + se.Message, "Exception occurred in MQPeekCompletedCallback()"); } finally { if(mq != null) { mq.BeginPeek(new TimeSpan(0,1,0)); } } } ==============================================================

    C# help question winforms graphics data-structures

  • DataGrid, Generic GDI+ errors, and a Big Red X
    I inyoursadachine

    Hi, I'm populating a DataTable in a DataGrid via asynchronous callbacks. Right now my program is single-threaded and I add each "event" (actually a MSMQ msg) to a Queue using lock in the PeekCompletedHandler. I process MSMQ peeks by firing a timer every 3 seconds and, if the queue has events, dequeue the msgs with lock. Sometimes the program will run for hours with no problems. Sometimes I get an exception saying a Generic GDI+ error has occurred and the DataGrid's screen real-estate is blanked-out and has a big red "X" throught it. I can't figure out what it causing this. Does anybody what is wrong and how I fix this? TIA, Matt

    C# help question winforms graphics data-structures

  • Populating TreeViews with data acquired from void static callback methods
    I inyoursadachine

    Hi, I'm trying to populate a TreeView with info I'm gathering via a PeekCompleted callback for a MessageQueue. My PeekCompleted method, which is "void static", does not have any trouble populating a ListBox but the compiler complains that I must use Control.Invoke() from the callback to use TreeNode.Add(). Here are my questions: 1) Why? 2) Should I use Control.Invoke() or do this another way? All I'm trying to do is build a TreeView using data I collected from a callback method. What are my other options? TIA, Matt

    C# question

  • MSMQ Peek Callbacks and duplicate messages
    I inyoursadachine

    Hi, I am monitoring 2 MessageQueues (MSMQ) via the PeekCompleted callback. It seems to be working but I get a lot of duplicate msgs. By duplicate I mean I receive 2+ messages with exact same System.Messaging.Message.Id. Is this normal? Doesn't seem efficient to me and I wonding if I'm doing something wrong? TIA, Matt

    C# question

  • Convert Unix Time to DateTime (C#)
    I inyoursadachine

    Does anyone know how to convert Unix time (seconds since Jan 1, 1970) to a C# DateTime object?? TIA, Matt

    C# csharp tutorial question

  • How do you bind data to a CheckedListBox?
    I inyoursadachine

    Hi, Can anyone tell me (via example is preferred) how to bind to a CheckedListBox in a Windows Form? All the docs I've seen allow you to bind to a control property (i.e. TextBox.Text) to an instance variable property. How do you bind to both the 'ItemText' and 'Checked' values for each Item in a CheckedListBox? TIA, Matt p.s. Also, I'm new here and I did look for a way to search all threads on the C# Discussion board but did not see how. Please advise.

    C# tutorial csharp question discussion
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups