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
J

jklucker

@jklucker
About
Posts
16
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • So i was in the pub...
    J jklucker

    You are right we don't benefit from getting Mock over here in the states. I watched it while I was in England on holiday and I loved that show. I laughed my arse off the entire show.

    I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

    The Lounge com question learning

  • Cream of the Crop IT Job
    J jklucker

    That seems a bit fishy to me...

    I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

    The Lounge question career

  • New to Excel Programming in C#
    J jklucker

    You want to look in the object browser. The application is actually an inerface for the Excel object. Unfortunately I don't have a system with OfficeXP on it. With was little, and I mean little, I read on this subject it should work the same. I have users that OfficeXP installed and are able to use my application that I wrote referencing Office 2003. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

    C# database question csharp com lounge

  • New to Excel Programming in C#
    J jklucker

    What version of MS Office do you have? This code was built using MS Office 2003. The file being reference is the actual Excel.exe of your installed Office product. I reject your reality and substitute my own! - Adam Savage, Mythbuster - George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

    C# database question csharp com lounge

  • New to Excel Programming in C#
    J jklucker

    You really don't need to know what the dll name is to reference the Excel object. Just right mouse on references in the Solution Explorer and click on Add Reference. Click on the COM tab and choose the Microsoft Excell 11.0 Object Library and click on select. Add the following to your form's constructor: ExcelObj = new Excel.Application(); // See if the Excel Application Object was successfully constructed if (ExcelObj == null) { MessageBox.Show("ERROR: EXCEL couldn't be started!"); System.Windows.Forms.Application.Exit(); } // Make the Application Visible ExcelObj.Visible = false; Add, ExcelObj.Quit();, to the form's dispose method so Excel will shutdown when you application shut's down. If you don't do this then you flood your system Excel's in your task manager. Here is the code you need to open an Excel workbook and display it's worksheet. private void DispSheets(string FileName) { // *********** Here is the call to Open a Workbook in Excel **************** // It uses most of the default values (except for the read-only which we set to true) theWorkbook = ExcelObj.Workbooks.Open( FileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 0, 0); foreach (Excel.Worksheet WrkSht in theWorkbook.Worksheets) { this.lstWrkSheets.Items.Add(WrkSht.Name); } } You can use the next two methods to read data from an excel spreadsheet iinto a list box. private void btnShowData_Click(object sender, System.EventArgs e) { int iFirst = 0; int iLines = 0; this.lstXLSData.Items.Clear(); //this.lstSelectedColumns.Items.Clear(); // get the collection of sheets in the workbook Excel.Sheets sheets = theWorkbook.Worksheets; // get the first and only worksheet from the collection of worksheets Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(this.lstWrkSheets.SelectedIndex+1); // find starting row iFirst = RowStart(); // find row total //iLines = RowTotal(); iLines = 25; // loop through user specified rows of the spreadsheet and place each row in the list view for (int i = iFirst; i <= iLines; i++) { //this.sbpInfo.Text = "Importing row " + i + " of " + iLines; Excel.Range range = worksheet.get_Range(this.cmbStartCol.Text + i.ToString(), this.cmbEndCol.Text + i.ToString()); System.Array myvalues = (System.Array)range.Cells.Value2;

    C# database question csharp com lounge

  • how can i get the ip addres of host on windows application
    J jklucker

    If you are referring to the local PC as host you could use WMI to retrieve the IP address. using System.Management public ArrayList ActiveIP() { ObjectQuery oq = new ObjectQuery("Select * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=true"); ManagementObjectSearcher mos = new ManagementObjectSearcher(oq); ArrayList NA = new ArrayList(); foreach(ManagementObject moInfo in mos.Get()) { string[] IP = (string[])moInfo["IPAddress"]; NA.Add(IP.GetValue(0).ToString()); } return NA; } This will return all the IP address the PC has. Hope this helps! I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

    C# question

  • Status Bar
    J jklucker

    Use Application.DoEvents() try { statusLabel.Text = Attempting to connect..."; Application.DoEvents(); DataCon.Open(); } Basically calling the Application.DoEvents() forces your application to process everything up that point before proceeding to the next step in your code. Without it your user interface will appear to lock up until your done working with your data connection stuff. The other way to accomplish this would be to spawn your data connection stuff on another thread which then would make the main thread process the UI changes. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes. My definition of an expert in any field is a person who knows enough about what's really going on to be scared. - PJ Plauger

    C# question

  • Any Cpians near Philly?
    J jklucker

    Susquehanna Valley I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    The Lounge question learning

  • How to know when ThreadPoll is finish?
    J jklucker

    One solution would be to create an event CloseSerialPort and call it from the onDataReceived method when it has finished it's job. Then you could put all the code needed to close your serial port in the event handler. I reject your reality and substitute my own! - Adam Savage, Mythbuster -George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    C# tutorial question

  • Double-clicking the Desktop opens the Start Menu?
    J jklucker

    I'm writing a desktop security application which uses findwindow and showwindow API's to hide the desktop. The problem I have is if the user double clicks on the background the start menu appears. This also occurs if you set the policy value NoDesktop. Hive: HKEY_CURRENT_USER Key: Software\Microsoft\Windows\CurrentVersion\Policies\Explorer Name: NoDesktop Type: REG_DWORD Value: 1 Can anyone tell me how to stop the start menu from appearing? Thanks in advance! I reject your reality and substitute my own! - Adam Savage, Mythbuster - George W Bush life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    C# security json help tutorial question

  • Auto Login
    J jklucker

    I use the following code to do what you want to do. I have changed some names to protect the innocent, so where you values inside <>, just change it to reflect what you need. Usage: Just copy and paste into a class file. Good Luck!:-D using System; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; namespace APPLoginWindow { /// /// Summary description for Class1. /// public class APPLogin { private object data; #region Contructor, dispose, main public APPLogin() { getAPPLogin(); } #endregion #region win32 imports public delegate bool EnumWindowsCallback(int hwnd, int lParam); public delegate bool EnumThreadProc(IntPtr hWnd, IntPtr lParam); [DllImport("User32.dll")] public static extern int GetWindowText(int hwnd,StringBuilder lpString, uint bufferSize); [DllImport("User32.dll")] public static extern int EnumWindows (EnumWindowsCallback callback, int lParam); [DllImport("User32.dll")] public static extern int EnumChildWindows (int hWndParent, EnumWindowsCallback callback, int lParam); [DllImport("User32.dll")] public static extern bool EnumThreadWindows (uint threadId, EnumThreadProc pfnEnum, IntPtr lParam); [DllImport("User32.dll")] public static extern int RealGetWindowClass(int hWnd,StringBuilder pszType,uint bufferSize); [DllImport("User32.dll")] public static extern int SendMessage( int hwnd, int uMsg, int wParam, [MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPStr)] string lParam); [DllImport("User32.dll") ] public static extern int FindWindow (string lpClassName,string WindowName); [DllImport("User32.dll") ] public static extern int FindWindowEx (int hWnd,int hWnd2,string lpsz,string lpsz2); [DllImport("User32.dll") ] public static extern int SetWindowText(int hWnd,string lpsz); #endregion #region Constants + fields public static int GW_HWNDNEXT = 2; public static int GW_CHILD = 5; public static int GW_OWNER = 4; public static int GWL_HWNDPARENT = -8; public static int WM_SETTEXT = 12; public const int HWND_MESSAGE = -3; public const int BM_CLICK = 0x00F5; //Clicking a button public const int WM_CHAR = 258; private string _windowText = ""; #endregion #region Callback functions for listing windows private bool displayAPPLogin(int hWnd, int lParam) { StringBuilder windowName = new StringBuilder(255); StringBuilder className = new StringBuilder(255); GetWindowText(hWnd, wind

    C# tutorial

  • DLL Config File
    J jklucker

    You are right I can create my own config file and access like XML. I was looking to use the app.config functionality that System.Configuration.AppSettings gives us access to. I like the google fight, I never heard that before. I'll have to remember that. It just goes to show how spell checkers are relied upon.:-> I reject to reality and subsitute my own! - Adam Savage, Mythbuster life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    C# help question

  • Hide the TaskBar Using C#
    J jklucker

    First you will need to reference two Win32 API's: [DllImport("user32.dll")] private static extern int FindWindow( string className, string windowText ); [DllImport("user32.dll")] private static extern int ShowWindow( int hwnd, int command ); There are then two constants you need to pass in the command paramter of the ShowWindow API. private const uint SWP_SHOWWINDOW = 0x40; private const uint SWP_HIDEWINDOW = 0x80; Finally, you would then specify the appropriate const value for the ShowWindow command paramter. The Shell_TrayWnd name was found using Spy++. int hWnd = FindWindow("Shell_TrayWnd", ""); ShowWindow(hWnd, SWP_ShowWindow | SWP_HideWindow); I reject to reality and subsitute my own! - Adam Savage, Mythbuster life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    C# question csharp

  • DLL Config File
    J jklucker

    Dave Kreskowiak wrote: Any settings code you write would be looking at the host application's config file, whatever that may be. I thought that to, but it doesn't seem to be true. So I guess the only true way of doing this would be to modify the Web Reference source file and modify it's constructor to require the URL to the web service. The only problem with this solution would be when you update the web reference then this file would be recreated and the changes would be lost. As for my signature, the quote is correct as stated. Pay close attention to the opening of Mythbusters.

    C# help question

  • DLL Config File
    J jklucker

    I have a DLL I wrote that uses a web service. I set the 'Web Reference URL' to dynamic. I see in the app.config file that the value is present. My problem is when I compile the DLL the config file is not generated. Question #1: Is this normal behavior for a DLL. Question #2: Could copy and rename the app.config file to '.dll.config' and the DLL use it normally? Any help would be greatly appreciated! Thanks in advance! I reject to reality and subsitute my own! - Adam Savage, Mythbuster life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    C# help question

  • combobox and auto-completion
    J jklucker

    Sample c# //************************************************************************************ // Call the corresponding functions from your form's Combobox's KeyUp and // Leave events //************************************************************************************ private void ACCombo_KeyUp(ComboBox cbo, KeyEventArgs e) { //Allow select keys without autocompleting switch(e.KeyCode) { case Keys.Back: case Keys.Left: case Keys.Right: case Keys.Up: case Keys.Delete: case Keys.Down: return; } //Get the typed text and find it on the list string strTypedText = cbo.Text; int intFoundIdx = cbo.FindString(strTypedText); //If we found the typed text in the list then autocomplete if(intFoundIdx >= 0) { //Get the item from the list (Return type depends if datasource was bound //or list created) object objFoundItem = cbo.Items[intFoundIdx]; //Use the listcontrolgetitemtext to resolve the name in case the combo //was data bound string strFoundText = cbo.GetItemText(objFoundItem); //Append then found text to the typed text to preserve case string strAppendText = strFoundText.Substring(strTypedText.Length); cbo.Text = strTypedText + strAppendText; //Select the appended text cbo.SelectionStart = strTypedText.Length; cbo.SelectionLength = strAppendText.Length; } } private void ACCombo_Leave(ComboBox cbo) { int intFoundIdx = cbo.FindStringExact(cbo.Text); cbo.SelectedIndex = intFoundIdx; } Let me know if you need this for VB.NET:) I reject to reality and subsitute my own! - Adam Savage, Mythbuster life is like a roll of toilet paper. The closer it gets to the end, the faster it goes.

    C# question learning
  • Login

  • Don't have an account? Register

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