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
U

uniflare

@uniflare
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • (SOLVED) C# .NET File.Delete() Not Working.
    U uniflare

    SOLUTION make sure to refresh the folder your checking to see if the files have actually deleted or not. In this case they were (the code works fine), just i wasn't refreshing desktop etc haha, oh well. STUPID QUESTION CONTINUES------------- http://s000.tinyupload.com/index.php?file_id=06162948769787766673[^] The link above is a localized example of my problem. I cannot for the life of me figure out why file.exists or any kind of permission checks don't work! Its like .NET just says oh.. I might delete this, might not, might say i did but actually didn't, or didn't but actually.. didn't, maybe i will if you give me time... but i still wont tell you even if i did or didn't... :confused::mad::confused: so... please save the last few strands of hair on my head! :doh: Thanks! (For ease of viewing: pastebin) or right here:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.IO;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using IWshRuntimeLibrary;

    namespace test
    {
    public partial class TestFileDelete : Form
    {
    Boolean flag = true;

        public TestFileDelete()
        {
            InitializeComponent();
        }
    
        private void button1\_Click(object sender, EventArgs e)
        {
            // disables while running click code
            this.button1.Enabled = false;
    
            // This doesnt seem to do anything either?
            if (this.button1.Enabled == false) return;
    
            // just a either or flag to swtich the end of the shortcut names to see if they are deleted or not with one button
            int switchnum = (flag) ? 1 : 0;
            int newnum = (flag) ? 0 : 1;
            if (flag == true)
            {
                flag = false;
            }
            else
            {
                flag = true;
            }
    
            // this is a bit messy, its taken from my larger project. but this code shows my problem. (in fact my larger project only requires a 200ms timeout, this needs 300..?)
            String StartMenuProgName = Path.Combine(Environment.GetF
    
    C# csharp question php database linq

  • List Box showing Value and Display members?
    U uniflare

    Thanks for the detailed response, your explanation does seem logical. Thanks again guys!

    C# help question

  • List Box showing Value and Display members?
    U uniflare

    Ok did some debugging, it seems that when i set a new datasource, the combobox.DisplayMember defaults to "". Although the combobox.ValueMember stays as "Key". the fix Im using is to re-set DisplayMember to "Value" on each datasource update. Is this a bug? Is it supposed to reset these properties when the datasource is set? or is it my implementation that is buggy? All other factors are identical. The actual problem was only the very FIRST datasource set worked as intended, every subsequent datasource was displayed improperly with displaymembers and valuemember being shown in the listbox. Revised Code Example: (Working with fix) (Compiles and runs with the components on designer..)

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace etstapp1
    {
    public partial class Form1 : Form
    {
    private skbtServerControl sc;
    public Form1()
    {
    InitializeComponent();

            this.sc = new skbtServerControl(this);
    
            // coxArmaPath = Combo Box (simple drop down)
            this.cBoxArmaPath.ValueMember = "Key";
            this.cBoxArmaPath.DisplayMember = "Value"; // This doesnt seem to stick after the first datasource set??
            // ....
        }
    
        public void addServerPathItem(String Key, String Value)
        {
            this.cBoxArmaPath.Items.Add(new KeyValuePair(Key, Value));
            // This works fine, only the "DisplayMember" is displayed and the "ValueMember" is hidden.
        }
    
        // This acts differently with the same types???
        public void setServerPathDatasource(List\> source)
        {
            this.cBoxArmaPath.DisplayMember = "Value"; // fix datasource problem
            this.cBoxArmaPath.ValueMember = "Key"; // fix datasource problem
    
            this.cBoxArmaPath.DataSource = new BindingSource(source, null);
        }
    
        public void clearPathBox()
        {
            if(this.cBoxArmaPath.DataSource == null){
                this.cBoxArmaPath.Items.Clear();
            }
            else
            {
                this.cBoxArmaPath.DataSource = null;
            }
        }
    
        private void btnStatic\_Click(object sender, EventArgs e)
        {
            this.sc.refreshformWindowWithSTATICDatasource();
    
    C# help question

  • List Box showing Value and Display members?
    U uniflare

    Ok this is a CONCEPT problem (the code is not professional, just read it for the concept, though it does compile and run). Right, I have asked many people on IRC and no one is giving me a straight answer lol so maybe some professionals can help me. I am trying to use a Datasource property for my combobox. This is so I can just pass an entire KeyValue pair with indexes and values to be shown in the listbox. Creating the keyvaluepair as a WHOLE and passing that to datasource property works perfectly. Creating a keyvaluepair PROCEDURALLY (in a loop or w/e) ends in the datasource property ToString()ing it, list box items show BOTH value AND display members in square brackets as an entire option. NOTE: Getting the lsitbox.value results in ONLY the valuemember being returned even though the listbox shows both the valuemembers AND the displaymember? it knows they are different? Now, I dont want any alternatives or comments about the quality of the code, all I want to know is WHY is it doing this, it seems compeltely illogical that the same TYPE and Values and can different Effects within the datasource property? Its like it knows it was built procedurally? Anyway here is some code for reference:

    // Windows Form

    namespace skbtInstaller
    {
    public partial class frmMainWindow : Form
    {
    public frmMainWindow()
    {
    InitializeComponent();

        // coxArmaPath = Combo Box (simple drop down)
            this.cBoxArmaPath.ValueMember = "Key";
            this.cBoxArmaPath.DisplayMember = "Value";
        // ....
        }
    
        public void addServerPathItem(String Key, String Value)
    {
            this.cBoxArmaPath.Items.Add(new KeyValuePair(Key,Value));
        // This works fine, only the "DisplayMember" is displayed and the "ValueMember" is hidden.
        }
    
    // This acts differently with the same types???
        public void setServerPathDatasource(List\> source)
        {
            this.cBoxArmaPath.DataSource = new BindingSource(source, null);
        }
    }
    
    public class skbtServerControl
    {
        private frmMainWindow frmMainWindowHandle;
        public void refreshformWindow()
        {
            // Clear Drop Box (empties drop box)
            this.frmMainWindowHandle.clearPathBox();
    
        //skbtServerConfig is very simple property object
            foreach (KeyValuePair pair in CoreConfig.getServerConfigList())
            {
    
    C# help question
  • Login

  • Don't have an account? Register

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