-
- Remoting, and Threads, and Services Oh My!:Possible synchronization issue?
by mwalts
- 4 Replies
- Last post
by Steve Py
- Ok, I have a service that is running on a remote machine. This service allows the client to access two remote objects, which are singletons. One just provides access to a database and seems to work fine. The other object implements a producer consumer model, using a queue and seems to be were the problem lies. When the producer adds an element to the queue, it signals the consumer (each time). The
-
- C# still going strong?
by Bear23
- 4 Replies
- Last post
by Anonymousaaaaaaaaaaaaaaaahhhh
- I was just wonder if c# is still going strong or is vb.net taking over. Everything I go to vb.net page i see microsoft creating new power packs, etc. Why is that never offered to c# users Seems like vb.net is really more focused then c#.
I have concentrated on the c# language for over a yr now but now I am starting to think I should have stayed more in vb.net and just touch c# as it seems t
-
- What is the oops concept of shadowing in C#?
by recherche
- 4 Replies
- Last post
by timvw
- Hola!
What is the oops concept of shadowing in C# Is it the same as hiding, using 'new' keyword How do you choose between 'override' and 'new', as I don't see any difference (apart from the fact that only virtual methods in base class can be overridden in derived class) in the following program:
using System;
class BaseClass { public virtual string overridingMethod() {
-
- Cross-thread operation not valid & Backgroundworker
by yoda_143
- 4 Replies
- Last post
by Matthew Watson
- namespace WindowsApplication1 { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } private void go_button_Click(object sender, EventArgs e) { go_button.Visible = false; result_list.Visible = true; backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork); this.backgroundWorker1.Worke
-
- Unable to cast object of type 'Enumerator[MyObject]' to type System.Collections.Generic.IEnumerator`1...
by Ross Holder
- 5 Replies
- Last post
by TaylorMichaelL
- My question is very specific. Consider the class enclosed in the article at this URL:
http://keithelder.net/blog/archive/2006/03/10/Converting-Generic-Lists-or-Collections-to-a-DataSet.aspx
Then, consider the following excerpts from a class I'm working on:
Code Snippet
108 CategoryDataSet < List < Category >> dsCategory = new CategoryDataSet <
-
- DllImport only works in VS but not in the exe
by sun450
- 4 Replies
- Last post
by Peter Ritchie
- Hi,
I have a C# application which has several dllImport calls like
[DllImport("ba.dll", EntryPoint = "BstateNxt")] private static extern void BstateNxt(long p)
The interface in c++ code of ba.dll is the following:
//return the address
__declspec(dllexport) long BstateNxt(long p) { return (long)((BState *)p)->nxt; }
If I run the
-
- Visual C# coding
by Baldwintm
- 4 Replies
- Last post
by Mark Dawson
- Let me preface this by saying that I am a newb with C#.I am getting the error in the subject above. here is the code sample :
Code Snippet
class Class1 { ... public void Method1() { Thread.AllocateNamedDataSlot(word); Thread begin =new Thread(new ParameterizedThreadStart(Class2.method2)); begin.Start(word); } } class Class2 { ... public void Method2(object w) { myWo
-
- Multithreading : 'lock' statement is not working
by babakf
- 4 Replies
- Last post
by Matthew Watson
- Hi, For testing 'lock' statement in multithreading, I created a sample programme (which I've added its code at the end). It's not working as I expect. This programme simply has 2 threads. 'th1' writes a character in richtextbox (which is a member of Form1 class : 'c'), and 'th2' do nothing but locking the member of Form1 class that is used by 'th1' to write in richtextbox (which is the same 'c').
-
- Problems Storing Data
by PedroMgodinho
- 5 Replies
- Last post
by Figo Fei - MSFT
- Hello All, I'm making an application using different forms and I have a little difficult situation in my hands. Well... In my program I have two different form, with some radial check buttons and box check buttons in my second form. I have this code for first form: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System
-
- How to add Zero to an integer value from left (like 999 to 0999)
by ranadheer mac
- 7 Replies
- Last post
by ranadheer mac
- hello, any body please tell me how to add "0" to an integer from left i just want to make my value 999 to 0999 and i tried with converting it to strings but after adding zero i have to make the string to integer again because my method accepts integers onli. thanks in advence ranadheer
-
- System.AccessViolationException when trying to call C++ dll function
by aM000
- 6 Replies
- Last post
by vishal82
- Hi,
I have an C++ ActiveX dll which I am trying to call from C# project by adding reference to it in the solution. The Visual Studio itself converts function parameters from C++ to C#. One of the functions in C++ looks like the following:
Scan(unsigned char* List);
If used like this in C++ it works fine:
for (i=0; i<10; i++)
List = ( unsigned char *)malloc(100);
Scan((
-
- How to enforce two decimal places
by bslim
- 1 Replies
- Last post
by Mark Dawson
- Hi all,
I had used the following to do a simple mathematical calculation.
But when the result is 0, it will return only 0%.
How can I enforce that it will return 0.00%
Please help.
Thanks
Math .Round((diff)/ double .Parse((lblGross.Text) * 100, 2) + "%" .PadRight(6)
-
- How to ensure the first process had finished
by bslim
- 3 Replies
- Last post
by Bulldog.NET
- Hi all,
I had to execute 2 processes.
process1 = System.Diagnostics.Process.Start("CMD.exe", strCmdLine);
How can I ensure that process1 had finished before I run process2
Please help.
Thanks
-
- Consequences of keyword "event" in C#
by Jabberwocky
- 13 Replies
- Last post
by Peter Ritchie
- Hi, is there an MSDN help page that clearly lists the consequences of the "event" keyword in contrast to omitting it Also, the "event" keyword is not listed as an access modifier (like public, private), but in my understanding it is nothing else:
Code Block public class MyTestClass { public event EventDelegate myEvent; public EventDelegate myCallback; ... A second cla
-
- enfore constructor with signature
by Anu Viswan
- 2 Replies
- Last post
by Vivek Ragunathan
- hi
can i specify in a interface or something that the class that use it should implement a constructor with certain parameter
I want to say something like this, that, the classes should implement a constructor that would take a certain signature for sure.
is it possible through interface or any other way
-
- Adding Hashtable setting to project settings doesn't work
by cygnusx
- 10 Replies
- Last post
by Chunsheng Tang - MSFT
- When i add setting with type Hashtable in project settings(Project - Properties - Settings) i cannot add anything to the Hashtable.I mean i can't add keys to the Hashtable from the small button in the "value" column,the buttons in the opened window are not active.Therefore obviosly i cannot add keys to the hashtable in the code designer because the Hashtable doesn't have a value...Is the
-
- Print calendar for a given year and month combination
by Neric
- 6 Replies
- Last post
by ThE_lOtUs
- I have a question about creating a calendar function with system. Need a program that reads a date and tells you on what day of the week that date falls. The program should take 3 command arguments, month, day, year. For month use 1 for Jan, 2 for Feb, and so forth. Formula for Gregorian Calendar:
a=14 - month/12
y = year -a
m= month +12a -2
d= (day + y + y/4 -y/100 +y/400 +31m/12) % 7
-
- Regex File parsing
by ReneeC
- 11 Replies
- Last post
by OmegaMan
- Hi,
I'm an experienced developer but new to both C# and Regex. I'd like a regex based boolean function with two string inputs:
Arg1: InputMask Arg2: Filename
The functionality needs be match the parsing capability of DOS Dir. In other words, it needs to be able to handle rich use of wildcards.
Output: A boolean is true is returned, when there is a match between a fil
-
- How can I handle the copy operation in C#?
by FTGforever
- 5 Replies
- Last post
by Peter Ritchie
- Hi I'm a C# programmer (just a beginner !) and i was asked to control the copy operation in windows (allow or stop copy operation based on criteria i choose preferably controlled in a lan) . Al my researches came to nothing please help.
-
- Converting date to system current date time format
by Hemant Hindlekar
- 13 Replies
- Last post
by Hemant Hindlekar
- Hello
Can somebody help me for below problem
In my .Net application I am using vb component having one method which accepts DateTime as a parameter. This value will be inserted into the database. The value to be passed to this method will be taken from some other database. Before passing this datetime variable I want to set the date format as a current culture system datetime format with Sho
-
- Problem using "continue", "yield return", and "using" in the same method in C# 2.0.
by ScottBK
- 3 Replies
- Last post
by Matthew Watson
- Greetings.
I have a method that uses yield return to generate values for an IEnumerable, and also uses a using statement and a continue statement. These seem to not play well together, as the method is leaking system resources. I have isolated a test case, and it seems to me that Dispose() is not getting called when it should be. I suspect the compiler is generating incorrect code.
Here is a
-
- Disable Winkey
by Santro
- 2 Replies
- Last post
by Santro
- Dear Friends, I want to disable the WinKey on the keyboard for my application. I have checked out that we can do that by changing in the registry, however it asks me to restart the computer for the changes to take effect. However, I do not want to restart my computer. Do you guys have any idea as of how to disable the Winkey For more clarification, I want to tell you that I have followed the s
-
- Is There Any Overhead to Using a Local Referece
by Greg McPherran
- 9 Replies
- Last post
by Greg McPherran
- Hello,
Suppose I had an object specifier with many characters e.g. This_Object.That_Object_has_a_Long_Name.X and everywhere in the code I don't want to use that long name but rather use a reference variable: object X = This_Object.That_Object_has_a_Long_Name.X;
Does the compiler create an extra variable for X I question if it does because in the method where the object is used, the
-
- Using WinMM.dll for other audio formats?
by CloudyOne
- 2 Replies
- Last post
by CloudyOne
- I'm trying to get a tool i'm making to make my job a little easier to be able to play sound files other than .wav Here's my class:
Code Snippet
public class WSounds { [DllImport("WinMM.dll")] public static extern bool PlaySound(string fname, int Mod, int flag); public int SND_ASYNC = 0x0001; public int SND_FILENAME = 0x00020000; public int SND_PURGE = 0x0040; pub
-
- C# pointer
by Michael_Grumbach
- 4 Replies
- Last post
by Chuck the Code Monkey
- I need to create a C# pointer for a DLL function.
I wrote
byte* Read_Data_ptr,
but I get the error:
Pointers and fixed size buffers may only be used in an unsafe context
Any help with this would be geatly appreciated.
Thank you,
Mike