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
B

Brad Wick

@Brad Wick
About
Posts
49
Topics
26
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Setting the UserAgent for WebRequest
    B Brad Wick

    I have tried searching and everything I find says to use "WebRequest.UserAgent" but this isnt a valid option in my solution to add. Am I doing something wrong? The script is pulling content from the webpage 100% correctly, I just want to be able to specify the user agent also.

                byte\[\] data = System.Text.Encoding.ASCII.GetBytes(FormVariables);
    
                System.IO.Stream os = null;
                WebRequest request = null;
                WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials;
    
                request = WebRequest.Create(URL);
    
                request.ContentType = "application/x-www-form-urlencoded";
                request.Method = "POST";
                request.ContentLength = data.Length;
                request.Timeout = 420000;
    
                os = request.GetRequestStream();
                os.Write(data, 0, data.Length);
                os.Close();
    
                System.Net.WebResponse resp = null;
                resp = request.GetResponse();
    
                System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
                strResponse = sr.ReadToEnd().Trim();
    
    C# csharp agentic-ai algorithms tools question

  • Checking if app is running under a Admin account in XP
    B Brad Wick

    The application I am writing, the user has to right click on the file and tell the file to Run As and login with a admin account. Is there a way to tell if the user that is logged in running the program is a admin or not? This is in XP not vista.

    C# question

  • Dynamically adding a action to a datagrid
    B Brad Wick

    If I add that code I get a error on the EventHandler ('dataGridTicketInformation' is a 'variable' but is used like a 'method'). Any ideas? dataGridTicketInformation.DoubleClick += new System.EventHandler(dataGridTicketInformation);

    C# graphics tutorial question

  • Dynamically adding a action to a datagrid
    B Brad Wick

    Im just not able to get this going, so hopefully you can help. The error I am getting is Method Name expected on "dataGridTicketInformation, new CustomRowEventArgs(dataGridTicketInformation" I first specify the CustomRowEventArgs and the DoubleClick function

    public class CustomRowEventArgs : EventArgs
    {
    DataGridView grid;
    public DataGridView Grid
    {
    get { return grid; }
    }
    public CustomRowEventArgs(DataGridView dgv)
    {
    grid = dgv;

    }
    

    }

    private void dataGridTicketInformation_DoubleClick(object sender, CustomRowEventArgs e)
    {
    MessageBox.Show("DoubleClick Sent");
    }

    Then after I dynamically build and load all the information into the datagrid I call the doubleclick function

    dataGridTicketInformation.DoubleClick += new System.EventHandler(dataGridTicketInformation, new CustomRowEventArgs(dataGridTicketInformation));

    C# graphics tutorial question

  • Dynamically adding a action to a datagrid
    B Brad Wick

    In this application I am playing with, I am generating a tabcontrol on the fly where each tab is a folder name in a directory. I am then dynamically adding a new DataGridView onto the new tab that was created and listing out the files inside of this directory (there are no sub directorys which is the reason I am doing it this way). This is all working file exactly like what I want except I can not figure out how to build a dynamic onrow click event because I have no idea how many tabs the application will have in the future. Can someone point me in the correct direction? Listed below is the code that is looped through when adding the dataGrid to each tab (notice the name has the tabIndex). DataGridView dataGridTicketInformation = new System.Windows.Forms.DataGridView(); dataGridTicketInformation.Name = "dataGridView" + tabIndex.ToString(); dataGridTicketInformation.Size = new System.Drawing.Size(401, 201); // First we need to add a column dataGridTicketInformation.Columns.Clear(); dataGridTicketInformation.Columns.Add("Name", "Name"); dataGridTicketInformation.Columns[0].Width = 301; dataGridTicketInformation.Columns.Add("Data", "Data"); dataGridTicketInformation.Columns[1].Width = 100; // Clear all the old Data first dataGridTicketInformation.Rows.Clear();

    C# graphics tutorial question

  • Best practice for using Registry - UAC Issues
    B Brad Wick

    My application writes data into the Registry which is causing a UAC issue on vista. I keep data in the registry so I can access it across different applications we have (this is not a mass product but only installed on selected machines). Since I am storing data into the LocalMachine SOFTWARE keys, is that was is causing the UAC errors, or should I store the application config settings somewhere else?

    C# windows-admin help question discussion

  • DataGrid Textbox will not apply value unless enter is pushed
    B Brad Wick

    I was able to fix this as I had the datagrid set as this.dataGridTicketTypes.CausesValidation = false; changing this to true fix the issue

    C# question database help

  • DataGrid Textbox will not apply value unless enter is pushed
    B Brad Wick

    I have a DataGrid on my form that users type in numbers. The problem them I am having is that if they do not hit enter after they type in the number, that value is never set. How can I change this so its value is set without the user having to push enter? Is it the way I am pulling the data or something else? TixTypeQuanity = dataGridTicketTypes.Rows[dataGridTicketTypes.Rows[dgvr.Index].Index].Cells[4].Value.ToString();

    C# question database help

  • SQL Server Express - How many querys per a second can it handle?
    B Brad Wick

    I have a application I have built that uses a SQL Server express database to store the data. I have built a logging functions which writes the log entrys of whats going on in the application to a text file on the hard disk. When I set the logging to DEBUG mode (which logs a ton of stuff) it takes a long time for certain things to run as its writing a bunch of data to the text file. If they set the logs to WARN... it only writes important information to the log file. This all works great, but I would really like to log everything so if there is a problem with the application I can look at the users log file and tell exactly what they were doing to try and reproduce the error. So I was thinking about writing the logs to the database which would mean I could insert all entrys and just query the items I need to return which brings up my question. If i start to insert a ton of data into the database, at what point could I overload the database? XXX Querys a hour/second? Database reaches XXX size? I know this will depend on the users machine also, but its not going out to a wide user base, more like 10 people.

    C# database help question sql-server sysadmin

  • Manually add data to datagrid combobox in C#
    B Brad Wick

    I already had those skipped. My code looks like this which still does not add information to the drop down menu. private void button1_Click(object sender, EventArgs e) { DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell(); cell.Items.Add("0"); cell.Items.Add("1"); cell.Items.Add("2"); cell.Items.Add("3"); dataGridView1.Rows.Add("test", cell); }

    C# csharp help question

  • Manually add data to datagrid combobox in C#
    B Brad Wick

    The code you provided did add the items to a dropdown menu, however it added a new column in which it added this data which I want to specify it as I am adding values. 1. Create a new form 2. Add a datagridview1 to the form 3. add two columns to the data grid (IDColumn, valueColumn) 4. Add a button to the form which will insert a record 5. When you click on the button it should add one row to the DataGrid by using something like below (but that actually works).

    DataGridViewComboBoxCell cell = new DataGridViewComboBoxCell();
    cell.Items.Add("0");
    cell.Items.Add("1");
    cell.Items.Add("2");
    cell.Items.Add("3");
    dataGridView1.Rows.Add("test", cell);

    C# csharp help question

  • Manually add data to datagrid combobox in C#
    B Brad Wick

    I am trying to fill a combobox that is in a datagrid with values. The code compiles fine, but when it generates the datagrid it gives a error. "System.ArgumentException: DataGridViewComboBoxCell value is not valid". Any ideas what I am doing wrong? DataGridViewComboBoxCell colComboCell = new DataGridViewComboBoxCell(); colComboCell.Items.Add("0"); colComboCell.Items.Add("1"); colComboCell.Items.Add("2"); colComboCell.Items.Add("3"); dataGridTicketTypes.Rows.Add(EventTicketPrice_ID, colComboCell);

    C# csharp help question

  • Creating a upgrade .msi file
    B Brad Wick

    I have tried to find some information on the internet but can't seem to find any tutorials on this. Basically when someone install's my application I will have it check when they run the application to see if there is a update available. If there is a update available it will download and run the new MSI file. (This is all done). The problem I am having is when you run the new MSI file, I can not get it to actually upgrade the program. I have changed the Version number from 3.0 to 4.0 in the setup file and then select yes to update the ProductCode since I changed the version number. I have RemovePreviousVersions set at True and DetectNewerInstalledVersion to True. Am I missing anything or does someone know of a article that describes how to do this?

    C# announcement help tutorial question workspace

  • Add multiple values to a SqlParameter
    B Brad Wick

    I current have code to add the SQL Parameters to a array but when searching I need to sometimes not include the SQLParameter as its not required in the search. A example of my SQL Parameters is below which is passed to a function that runs the query. SqlParameter[] sqlparams = { new SqlParameter("@EventID", EventID), new SqlParameter("@Status", Status) }; I tried to use the following code but it produces a error if one of the two values is not in the query string (I do not insert the EventID or Status in the query string if its not being search) SqlParameter[] sqlparams = { EventID.Trim().Equals("") ? new SqlParameter() : new SqlParameter("@EventID", "%" + EventID.Trim() + "%"), Status.Trim().Equals("") ? new SqlParameter() : new SqlParameter("@Status", "%" + Status.Trim() + "%") }; What can I do to not include the @Status in the sqlparams if its empty?

    C# database algorithms data-structures help tutorial

  • Simple case statement looking for Enter key
    B Brad Wick

    I have the following case statement where I am looking for a enter key being pushed to be in the suffix. I need this to be a enter but I can not seem to figure out how to add the char(13) as I can not make it into a string and fit into the const setting. Can someone help me with this?

    string keyAscii = e.KeyChar.ToString();
    const string Prefix = "|~";
    const string Sufix = "";
    
    switch(keyAscii)
    {
        case Prefix:
            // Code
            break;
        case Sufix:
            //Code
            break;
        default:
            //Code
            break;
    }
    
    C# help tutorial question

  • Distinguish between Keyboard and basic Barcode Scanner
    B Brad Wick

    I am trying to figure out the best way to integrate this so that it can be customizable. My barcodes are always 12 characters long but you never know what might change in the future. So my thought is to look for two @@ which means were starting the barcode and then two @@ means the barcode has ended. I have activated the forms keypreview so I can now watch the keys on KeyPress. The problem I am having is trying to figure out the best way to make this dynamic and customizable by a config file incase the user wants to use three #'s instead of @.

    // First we set the config variables as to what the barcode variables will be
    private static string ConfigBarcodePreSuffix = "@";
    private static int ConfigBarcodePreSuffixTimes = 2;
    
    // Set the form variables so we can capture whats going on
    private static string Scanned_BarcodeText = ""; // Will hold the final barcode value
    private static bool Scanned_BarcodeBeingScanned = false; // Will hold a bool value so we know we scanning the barcode
    private static int Scanned_PreSuffixFoundTimes = 0; // How many times have we found this presuffix
    
    private void frmEventTicketVerify_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar.Equals(ConfigBarcodePreSuffix))
        {
            // This is the character were looking for so lets find out if its the start or end
            if (!Scanned_BarcodeBeingScanned)
            {
                // We have not started scanning the barcode so lets see if we hit it
                if (Scanned_PreSuffixFoundTimes == ConfigBarcodePreSuffixTimes)
                {
                    // This is how many times they are looking for the prefix so lets start the barcode
                    Scanned_BarcodeBeingScanned = true;
                }
            }
            else
            {
                // This is the ending of the barcode
                if (Scanned_PreSuffixFoundTimes == ConfigBarcodePreSuffixTimes)
                {
                    // This is how many times they are looking for the prefix so lets start the barcode
                    Scanned_BarcodeBeingScanned = false;
                }
            }
            // Move the prefix count up
            Scanned_PreSuffixFoundTimes++;
        }
        else
        {
            // This wasnt the key we were looking for so lets reset it
            Scanned_PreSuffixFoundTimes = 0;
        }
    
        if (Scanned_BarcodeBeingScanned)
        {
            // We are still inserting text from the barcode, so lets continue to add it
            Scanned_BarcodeText += e.KeyChar.ToString();
        }
        else if (!Scanned_BarcodeText.Trim().E
    
    C# question

  • Distinguish between Keyboard and basic Barcode Scanner
    B Brad Wick

    Yes I saw that, and I think that is what I am going to do. I wish I did not have to do this as I like the barcode application to send just the barcode so it can work with other things I have but appears to be the only choice. I use the POS-X Xi3000 ( http://www.posguys.com/barcode-scanner\_3/POS-X-Xi3000\_716/XI3000U\_9177/\[[^](http://www.posguys.com/barcode-scanner_3/POS-X-Xi3000_716/XI3000U_9177/ "New Window")] ) which is a great scanner, but I wish they had the ability to capture the scanner just like Symbol does.

    C# question

  • Updating StatusStrip text from class
    B Brad Wick

    I have read that it is bad practice, but I have been searching and reading all morning and I can not seem to find anything that is helping me do this the correct way. Can anyone help out with this?

    C# algorithms help question announcement

  • Distinguish between Keyboard and basic Barcode Scanner
    B Brad Wick

    I am in need of the same thing. We use symbol scanners and I know that I read somewhere that most manufactures have a dll file to integrate with your applications. This hasnt been something I have looked into yet but will be very shortly. Can you let me know if you find out something, or maybe we can help each other complete this?

    C# question

  • Updating StatusStrip text from class
    B Brad Wick

    I have a frmMain which has a StatusStrip on it. Inside my class I have a function which checks for internet connection and when the system is not online, I would like for it to update one of the labels on the StatusStrip. I have tried to do some searching and have tried some examples but can not seem to get it to work. I created the below function in frmMain.cs

    public void Set_StatusStrip(string status)
    {
        toolStripStatusInternetConnection.Text = "";
    }
    

    In inc_functions.cs I have the following function

    public void InternetConnectionAvailable()
    {
      // code to check for internet connection goes here
      frmMain.Set_StatusStrip("Application Online");
    }
    

    The error I get is "An object reference is required for the non-static field, method, or property." Can anyone see what I am doing wrong?

    C# algorithms help question announcement
  • Login

  • Don't have an account? Register

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