-
- Basic equation
by boomoto
- 2 Replies
- Last post
by boomoto
- Ok i'm still learning c# i'm doing a project for school and i'm tryign to create a basic program where it calculates the shippign cost based on weight, The problem i'm having is i can;t mutiply my final answer by 0.12 it gives me
Error 1 Operator '*' cannot be applied to operands of type 'decimal' and 'double'
now my code is this
private void Btn_Calculate_Click( object s
-
- Java's class SimpleDateFormat in C#
by jbrito
- 2 Replies
- Last post
by Martin Xie - MSFT
- Anyone knows an equivalent class of Java's SimpleDateFormat in C# Code in Java: SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd"); returnValue = dateFormatter.format(todaysDate.getTime());
-
- PInvoke conversion works fine but with Win32 error
by gudguy
- 4 Replies
- Last post
by gudguy
- From the 3rd party C++ header file: typedef enum { VBMTYPE_UNKNOWN = 0, VBMTYPE_AUDIO = 1, VBMTYPE_VIDEO = 2 } VBMTYPE; typedef enum { VBDIR_RECEIVE = 1, VBDIR_TRANSMIT = 2, VBDIR_BOTH = 3 } VBDIR; typedef enum { VBSTRM_MULTICAST = 1, VBSTRM_TCP = 2, VBSTRM_TUNNEL = 3, VBSTRM_UNICAST = 4 } VBSTREAMTYPE; typedef void ( CALLBACK *VBASYNCCALLBACK )( void
-
- Issue with network programming in C#
by Priyadharshini.S
- 1 Replies
- Last post
by Paul Louth
- Hello,
I am working on the TCP/IP application using C#. I have downloaded the source
code from CodeProject.com. I have loaded the application in my Visual Studio .NET
While I try to run the application i get the following error:
'System.Windows.Forms.Command' is inaccessible due to its protection level.
When I put this and searched in the google, i could not get the sol
-
- Unsubscribe from events
by Z. Margeta
- 4 Replies
- Last post
by Oren Novotny
- I was under the impression that the event handlers of odjects that go out of scope are automatically removed from their respective events, which does not happen in the following case.
I have a static object that exposes some events. There is also another object derived from Form, which holds a Developer Express control (not sure if it matters), and it subscribes to the static object's even
-
- Can Attributes help in this situation ?
by ShantanuAggarwal
- 5 Replies
- Last post
by Matthew Watson
- Hi,, I have one following question that whether attributes can help me in resolving this problem: I have one base class called Employee and I have 3 classes which inherit it: EmployeeA EmployeeB EmployeeC Now, the base Employee class contain 3 methods: void funct1() : needed for EmployeeA & EmployeeB void funct2() : needed for EmployeeB & EmployeeC void funct3() : needed for EmployeeC
-
- Variable problems
by dtsn
- 3 Replies
- Last post
by decyclone
- Hi, I'm trying to build a GA to solve Sudoku but i have seemed to come across a strange problem i've never seen before. I am calling a variable through a procedure and assigning it to another variable however when one variable changes so does the other and it's all in a for loop.
Code Snippet public class suduko { public int Fitness = 0; public int[,] grid = new int[9,
-
- userControl question
by ashk1860
- 2 Replies
- Last post
by Figo Fei - MSFT
- hi
I have created a userControl with several properties and I have all of them in properties panel. how can I make groups and order them in groups
-
- nullable on non value types
by John Basedow
- 18 Replies
- Last post
by John Basedow
- how can i do this
Nullable < string > s = null ;
-
- a design question
by shachar8
- 5 Replies
- Last post
by Derek Smyth
- hi all.
my team leader ask me to develope a small winform application.
this app should let the user select some files(from whereever he wants), set few other fields, and click "send files".
the file types are limited and some validation must be done before continuing.
my app should copy these files to the network, where a manager will look at them, and then it will copy them
-
- What's the equivalent of MIN/MAX in C++(std), for C#
by Azurewrath
- 14 Replies
- Last post
by Azurewrath
- Hi,
I found Math.Min/Max, but they seems to be different. Is there an equivalent of them in C#
Thanks,
aw
-
- 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
-
- Form [name] spontaneously changes back to button1 or whatever?
by c_edward_b
- 7 Replies
- Last post
by Figo Fei - MSFT
- Sometimes when I place a form, for example a button, on my interface and rename it (by typing new text like "try_estimate" into the [name] field in the Properties window), during later work the name will change back to whatever its default name was, for example "button1". If I have code behind it, the code breaks. On my latest project I've given up and stayed with the default n
-
- Expand/Collapse regions all at once
by SShell
- 2 Replies
- Last post
by SShell
- How can I expand/collapse ALL regions at once, either with a menu click or a keyboard shortcut (preferred) I'm not referring to the #region stuff, this is just the default + - boxes that appear on the left side of the pane by the line numbers, after you type in a function or other kind of code block.
Using VS 2005 Academic Edition
Thanks,
Scott
-
- migrate from .Net 2.0 to .Net 3.0
by George2
- 7 Replies
- Last post
by Peter Ritchie
- Hello everyone,
I am using Visual Studio 2005 and have some code built by both .Net Framework 2.0 and .Net Compact Framework 2.0 (two separate builds).
I want to build and test the code in both .Net Framework 3.0 and .Net Compact Framework 3.0. I can not find any guide about how to setup environment in Visual Studio 2005 to utilize .Net Framework 3.0 and .Net Compact Framework 3.0 to mak
-
- How To Get Excel Object From Process?
by MrZap
- 8 Replies
- Last post
by Jigar Patel
- Hello, Using following line i got all running Process/Instance of Excel : Process .GetProcessesByName( "EXCEL" ).
But after this i don't know how to get object from process/processid.
-
- Import Excel Spreadsheet Data into SQL Server Database Table
by Donaghy
- 7 Replies
- Last post
by Ashish Basran
- Hi All,
I am trying to import data from an Excel spreadsheet into a SQL server db table though having some issues. This is the code I'm using:
private void Button1_Click( object sender, System.EventArgs e) { // Connection String to Excel Workbook string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended Properties=""Excel 8.0;HDR=
-
- Thread Lock Question
by CodeHulk
- 5 Replies
- Last post
by Peter Ritchie
- I'm just kind of curious on this. I wasn't sure how to test it on my own as it is a threading issue and not reliable. Consider the following example.
Code Snippet
private object LOCK = new object();
private bool _Foo;
private bool Foo
{
get
{lock(LOCK){return _Foo}}
set
{lock(LOCK){_Foo = value;}}
}
Will this code ensure that is long as I use
-
- Avoiding namespace declaration in each file
by papadi
- 13 Replies
- Last post
by Citizen on the earth
- Hi! One feature of vb compiler is that namespace declaration behaves in an inheritance kind of pattern. It is defined in applicaiton level and code files only specify namespace if it is other than the default. Is it possible to do the same in C#
-
- How do you Export Template in VSTS?
by Jeffrey Toce
- 5 Replies
- Last post
by Joe Brinkman
- I'm using Visual Studio 2005 Team Suite. I've read all the help files on exporting a project template. There's just one problem- if I go to the File menu, the option Export Template just is NOT there. Am I missing something simple Or does this SKU not support export
Thanks,
Jeff
-
- preventing SQL Injection in C# code...................
by Hoodwinked
- 2 Replies
- Last post
by Mark Betz
- I am building my first ASP.Net app from scratch and while working on the DAL I came across the problem of SQL Injection. I searched on the web and read different articles but I am still unsure about the answer. My question is should I add
db.AddInParameter(dbCommand, "AvatarImageID" , DbType .Int32, avatarImageID);
Add in Parameters to my C# code to avoid SQL Injection.
-
- Events across threads
by ben.biddington
- 3 Replies
- Last post
by Emilio...
- With respect to the recommended asynchronous patterns (IAsync and event-based), is there anything wrong with simply registering for an event which will be raised from a worker thread Suppose I have a class with a member Execute, which raises event ExecuteComplete when done. If I then wish to run Execute in its own thread, can I still consume ExecuteComplete This means the event handler is runnin
-
- How to remove array elements
by Azurewrath
- 12 Replies
- Last post
by Thomas Danecker
- Hi all,
It is possible to remove array elements like the first 2 elements of each array
Thanks,
Aw
-
- namespace overlap
by MuscleHead
- 2 Replies
- Last post
by frederikm
- Hi,
Let's say assembly 1 has a namespace a.b
Another assembly 2 has a namespace c.a.d
('a' just happens to be the same word, but conceptually the two namespaces are different.)
In assembly 2 (i.e., within the block
namespace c.a.d { }
) how do I reference the namespace in assembly 1
Is there a way to tell the compiler that when I say a.b, I want that to be within the global na
-
- right-associative operator compiler bug
by Dmitry Kolchev
- 12 Replies
- Last post
by James Curran
- Hello,
int a;
a = 1; a += a += a += a += 1; Console.WriteLine("Result1={0}", a);
a = 1; a += 1; a += a; a += a; a += a; Console.WriteLine("Result2={0}", a);
Before running code above I think the first and the second result will be the same. After running this code I've been surprised the results are different (Result1=5, Result2=16). In my point of view the correct