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
V

Vitaliy Tsvayer

@Vitaliy Tsvayer
About
Posts
27
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • webservice async call vs backgroundworker?
    V Vitaliy Tsvayer

    Well, as I said it is not easy to do with only one web service call, but possible: one option is to implement Soap Extension, for instance like shown in http://www.codeproject.com/KB/webservices/Soap_Extension_Progress.aspx[^]

    Vitaliy Tsvayer Tikle

    C# css visual-studio design beta-testing help

  • /d:TRACE compiler flag for enabling tracing?
    V Vitaliy Tsvayer

    Yes, you will have to add this flag and possibly some more while using c# compiler from command line.

    Vitaliy Tsvayer Tikle

    C# question csharp debugging announcement

  • /d:TRACE compiler flag for enabling tracing?
    V Vitaliy Tsvayer

    I suppose you compile in Visual Studio. Just look at the output window after you compile you project. Visual Studio is adding this flag automatically for you. Search for /define:TRACE

    Vitaliy Tsvayer Tikle

    C# question csharp debugging announcement

  • Trouble updating DataGridView.Datasource in a different class - Error "An object reference is required for the non-static field, method, or property"
    V Vitaliy Tsvayer

    Your UpdateDeviceHistory method is static. But you are trying to access m_parent. You can't do that. Because m_parent is not static. To be more specific context of your program is needed but you could do this at least: 1. Remove static from your UpdateDeviceHistory method. 2. create Utility class instance and call UpdateDeviceHistory on that instance, that is: Utility utility = new Utility(some_form_with_HistoryDataView) utility.UpdateDeviceHistory() Good Luck

    Vitaliy Tsvayer Tikle

    C# csharp database tools help

  • webservice async call vs backgroundworker?
    V Vitaliy Tsvayer

    Well it depends on whether you have one web service call through which you get all your data or you have multiple separate web service calls to get your data. In the first case it won't be easy to update progress as web service needs to get the whole XML data before it can be parsed etc etc. It can be asynchronous but without progress updates. In second case BackgroundWorker is really suitable here. You do not need any loops as it is shown here http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[^]. You simply call ReportProgress() method to update current progress between your web service calls and handle ProgressChanged events to update progress bar. Hope this helps somehow.

    Vitaliy Tsvayer Tikle

    C# css visual-studio design beta-testing help

  • where i need to declare my array?
    V Vitaliy Tsvayer

    The reason you get new array object on every click, is that new instance of class _Default is created for every request. So you need to put this array object into store which is shared among different requests that is Session.

    Vitaliy Tsvayer Tikle

    C# design data-structures help question learning

  • Log file
    V Vitaliy Tsvayer

    Yes it seems like Flush() is missing. But for logging you should better use log4net[^]. It is very easy to configure and start writing log messages.

    Vitaliy Tsvayer Tikle

    C# sysadmin help

  • Arranging more than one image having transparent pixels....
    V Vitaliy Tsvayer

    Maybe this will help. How to Use Transparent Images and Labels in Windows Forms[^]

    Vitaliy Tsvayer Tikle

    C# csharp announcement

  • Circular layout algorithm
    V Vitaliy Tsvayer

    Hi, Do you know any open-source/free implementation/library for circular layout algortihm similar to this? Any ideas/links to any information on the topic would be usefull. Thanks.

    Vitaliy Tsvayer Tikle

    Algorithms html com algorithms tutorial question

  • Circular layout algorithm
    V Vitaliy Tsvayer

    Hi, Do you know any open-source/free implementation/library for circular layout algortihm similar to this? Any ideas/links to any information on the topic would be usefull. Thanks.

    Vitaliy Tsvayer Tikle

    C# html com algorithms tutorial question

  • How do I add Selected Cells
    V Vitaliy Tsvayer

    If I understand you right, you use DataGridView control with MultipleSelect set to true and when you select some cells you want to add numbers within them. To do that you can handle SelectionChanged event like below:

    private void dataGridView1_SelectionChanged(object sender, EventArgs e)
    {
    foreach (DataGridViewCell cell in dataGridView1.SelectedCells)
    {
    //NOTE: we should check whether value in cell is a numeric value
    //add values of cell
    }
    }

    BUT, be carefull to check whether selected cells has an integer value!

    Vitaliy Tsvayer Tikle

    C# question

  • Using reflection to call an internal method
    V Vitaliy Tsvayer

    MethodInfo method = type.GetMethod("SetTopic", BindingFlags.Instance | BindingFlags.NonPublic);

    Vitaliy Tsvayer Tikle

    C# wpf wcf com tools question

  • C# DataGrid Question
    V Vitaliy Tsvayer

    You can set DefaultCellStyle.WrapMode = DataGridViewTriState.True. So, you can enter value to cell as "Mike" + Environment.NewLine + "Bond". BUT, in this case if some other cell width is small its value will be wrapped as well. To avoid this you can leave DefaultCellStyle in its default value and set individual cell's style only.

    Vitaliy Tsvayer Tikle

    C# question csharp

  • DLL and Web Service Problem
    V Vitaliy Tsvayer

    Well, first let me explain the reason of this problem. When you add WebReference to the WebService, proxy class is created with all the types that come from WSDL(generated by ASP.NET for your WebService). BUT, although generated classes have the same fields as your original class from DLL, they are abolutely different entities, that is why you cannot cast from WS.Person to DLL.person for instance. One of the solutions would be to modify the generated proxy class so that return type of the WebService method is the class from your shared DLL and not generated one. You need to modify Reference.css under Web References. Another solutions is to write code that takes WS.Person class and creates new DLL.person class by copying all the fields, etc. You could use reflection to shorten the code as all field names are the same in both types. Maybe there are more elegant solutions, but hope this helps.

    Vitaliy Tsvayer Tikle

    C# help question tutorial

  • DLL and Web Service Problem
    V Vitaliy Tsvayer

    What error do you get?

    Vitaliy Tsvayer Tikle

    C# help question tutorial

  • xml
    V Vitaliy Tsvayer

    You could load data from xml file into XmlDocument, then add new xml data and save to the same file again. Something like this:

    XmlDocument doc = new XmlDocument();
    doc.Load("file_path.xml");

    //add new data
    XmlElement element = doc.CreateElement("NewElement");
    element.InnerText = "test data";
    doc.DocumentElement.AppendChild(element);

    doc.Save("file_path.xml");

    Vitaliy Tsvayer Tikle

    XML / XSL xml

  • How to remove a character from a string - help required
    V Vitaliy Tsvayer

    Not clear for me what you actually try to do, but hope short info will lead you to the solution. Unix environments use "\n" for newline, while Windows uses combination "\r\n". While in C you can use "\n" to indicate newline for both Unix & Windows environments, in c# you should specify explicitly what you want that is "\r\n" for Windows, and even better you should use Environment.NewLine SO, my guess is your CVS file is from Unix like environment so you should replace single "\n"s with "\r\n" OR you should correct the code which generates .CVS file to use correct new line value.

    Vitaliy Tsvayer Tikle

    C# question help csharp tutorial

  • Install !!?
    V Vitaliy Tsvayer

    HOW TO: Distribute the .NET Framework with a Visual Studio .NET Deployment Project

    Vitaliy Tsvayer Tikle

    C# question csharp workspace

  • CancelEventHandler?
    V Vitaliy Tsvayer

    Well,public MyDelegate MyEvent;
    is actually compiled as following:private MyDelegate MyEvent; [MethodImpl(MethodImplOptions.Synchronized)] public void add_MyEvent(MyDelegate value) { this.MyEvent = (MyDelegate) Delegate.Combine(this.MyEvent, value); } [MethodImpl(MethodImplOptions.Synchronized)] public void remove_MyEvent(MyDelegate value) { this.MyEvent = (MyDelegate) Delegate.Remove(this.MyEvent, value); }
    that is evet keyoword in c# creates methods to manage multicast delegate. And the following:class1.MyEvent += new MyDelegate(this.test_MyEvent);
    is simply a call to the add_MyEvent() method. And finally GetInvocationList() method is defined in MSDN as below: "Returns an array of delegates representing the invocation list of the current delegate. Each delegate in the array represents exactly one method. The order of the delegates in the array is the same order in which the current delegate invokes the methods that those delegates represent."

    Vitaliy Tsvayer Tikle

    C# question lounge

  • CancelEventHandler?
    V Vitaliy Tsvayer

    You could also do something like this:

       public class TestCancellableEvents
       {
           public static void Main()
           {
                TestClass test = new TestClass();
                test.MyEvent += new MyDelegate(test_MyEvent);
                test.MyEvent += new MyDelegate(test_MyEvent2);
    
                test.doit();
    	}
    
            void test_MyEvent2(object sender, CancelEventArgs args)
            {
               //do nothing this won't be called
            }
    
            void test_MyEvent(object sender, CancelEventArgs args)
            {
                //Cancel event, so the following handlers in the chain won't be called
                args.Cancel = true;
            }
    
        public class CancelEventArgs
        {
            bool cancel = false;
    
            public bool Cancel
            {
                get { return cancel; }
                set { cancel = value; }
            }
        }
    
        public delegate void MyDelegate(object sender, CancelEventArgs args);
        public class TestClass
        {
            public event MyDelegate MyEvent;
    
            public void doit()
            {
                Delegate[] list = MyEvent.GetInvocationList();
                CancelEventArgs args = new CancelEventArgs();
                foreach (MyDelegate handler in list)
                {
                    handler(this, args);
                    if (args.Cancel)
                    {
                        break;
                    }
                }
            }
        }
    

    Vitaliy Tsvayer Tikle

    C# question lounge
  • Login

  • Don't have an account? Register

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