|
I am sure we will see VB/Java/C# for ages to come. C# however is the only standardized language of the three langauges.
As a C++ programmer, moving to C# is fairly natural. It reminds me of my last major jump in lanaguages in 80's when I moved from Assembler to C. Moving to C++ was not much of a transition. In the early days of C, it seemed bulky and kind of slow since compared to Assembler but it added a lot of RAD development to our world at the time. For many things C was fine, but for some things you had to revert to Assembler where absolute speed was required. At the time, OS's were built with Assembler. Now they are usually built in mostly C/C++.
With C#, there is a lot of changes from C++, and it can seem slow for somethings and may require MC++. But in the future more things will move that direction and speed will increase as will computer speed.
One thing I am waiting to see happen, since C# is a standard, is a form of C# scripting added to browsers. May not have the entire .NET frameworks, but could still work well to handle client side code. I get turned off having to resort to Javascript when I code client side.
I am sure that no person can say that it will remain for sure or not, but the same goes for any language. During the last six months, I have heavily used C# and enjoy it as a language. There are a few things I would change but I can live with them.
C# gives you much of the ease that VB programmers have been used to for years without the stigma of being BASIC. As for as .NET is concerned though, it does not matter much which language you use, but the job listings for C# programmers are usually higher.
Rocky Moore <><
|
|
|
|
|
<br />
switch(twinsOnWay)<br />
{<br />
case ("twins on the way"):<br />
MessageBox.Show("for mr and mrs dynamic","twins on the way");<br />
break;<br />
--->Syntax Error - line4 ( missing } )
There are only 10 types of people in this world....those that understand binary, and those that do not.
|
|
|
|
|
the } isnt missing;P i just use that many lines on my profile signature on message boards. there's more code in the actuall form;)
switch(twinsOnWay)
{
case ("twins on the way"):
MessageBox.Show("for mr and mrs dynamic","twins on the way");
break;
|
|
|
|
|
hi does anyone know if there's an equivalent to the Split function in c# ?
|
|
|
|
|
See String.Split and Regex.Split.
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
cheers , although i'm struggling with it a bit, if i want to seperate the first space in a row of text, how would it be done? all i can find is info on arrays of stuff ( eg: i want to split this line "hello i'm a test" , so that all i get is "i'm" ) but all i've managed to find is some really complex stuff on msdn about splitting whole lines
in vb6 / vb.net i've always been able to do this...
Dim text as string
text = Split("hello i'm a test",chr(32))(1)
/// bringing back the "i'm" bit
any ideas?
|
|
|
|
|
Both the C# version and the VB6 version return an array, you are just accessing a specific element of that array in your example.
This should work:
string word = "hello i'm a test".Split(' ')[1];
To be more verbose, you are setting the variable word to the first element in the array returned by calling the Split method on the string "hello i'm a test".
The large downfall with the .NET version of Split is that it only splits on characters not strings. I don't think this is a problem with Regex's but I don't know for sure.
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
dynamic wrote:
Dim text as string
text = Split("hello i'm a test",chr(32))(1)
Code this on C# as:
string text = string.Split("hello i'm a test", ' ')[1];
Kant wrote:
Actually she replied back to me "You shouldn't fix the bug. You should kill it"
|
|
|
|
|
cheers guys that worked great
i've only decided this week to make a move over from vb6 / vb.net to c# so it's all new , although i'm beginning to grasp the concepts a bit now.
thanks a lot.
|
|
|
|
|
using System;
namespace testString
{
class testString
{
public static void Main(string[] args)
{
string secondword = "";
string text = "hello i'm a test";
string[] fragments = text.Split(new char[] {' '});
if( fragments.Length > 2 )
{
secondword = fragments[1];
}
Console.WriteLine(text + "\n" + secondword);
}
}
}
This will return i'm.
|
|
|
|
|
You can use the code sample I posted above just to test and see it write out the second word to the command line. Alternatively, here is a method you can add to your class or a utility class to just get the second word. This will return the 2nd word, or a zero-length string if there is no 2nd word. Yes I was bored Time to sleep now.
private string GetSecondWord(string TextIn)
{
string secondword = "";
string[] fragments = TextIn.Split(new char[] {' '});
if( fragments.Length > 2 )
{
secondword = fragments[1];
}
return secondword;
} Happy To Help,
Joe Mozelesky
imoz technologies, llc :: powered by imoz
|
|
|
|
|
I would like to know the procedure for Printing WinForm Controls, both Built-in and Custom Controls.
BETTER TO BURN OUT THAN TO FADE AWAY - Anonymous
|
|
|
|
|
Hi,
I am still amazed that nulls or blanks can not be entered in the DateTimePicker control. Everybody in my employee database needs to be terminated because of this (sarcastic).
I had to resort to either defaulting all dates with 1/1/1900 and then saving it as null in my Stored Procedures, or use a textbox with a custom coded 'format' capability for dates.
Does anyone know of a better way of doing this, that can be deployed in a marketed application. (not an in-house project where you can get away with iffy controls).
I am held up to go to production because of this and the textbox class not having an InputMask.
Thanks,
Chris
|
|
|
|
|
http://www.syncfusion.com/forums/message.asp?MessageID=1464
Here, sample code which exactly does what u want
-S
|
|
|
|
|
The web service works, but the methods are not available from a remote machine. Instead I get this "The testservice form is only available for requests from the local machine.". I've done this before, just messing around and it all went perfectly. Now that I'm under a deadline and actually working on a project I've run into this little nusance; any help anyone?
Fear not my insanity, fear the mind it protects.
|
|
|
|
|
Hi,
I have been battleing with the fact that there is no InputMask or Format property on the TextBox control in Windows Forms.
I have spent the last 8 months designing my classes, but I am still stuck on this.
How can I get the same Format capabilities of the DataGridColumn in a standard textbox.
I have played with the two examples that come up on Google, but they fall way short of a production capable control. I worked for the last two weeks to get this to work.
The example on C# Help is incomplete and does not have a link to the code.
Does anyone have or know of where I can get the code to format my textboxes?
I can not tell my customers that this functionality is not available.
In VFP, you just typed in $$$99.99 or !!!!!!! for example. I am trying to duplicate this or the DataGridColumn.Format.
Thanks,
Chris
|
|
|
|
|
Do a little searching, you will find a masked edit box at code project itself, shows you how to implement a Masked box for decimals, ints. social security, ips . etc ..
-S
|
|
|
|
|
Hi Sameer,
I actually had Michael send me his code from the example posted on C# help. It used regular expressions.
I am working on it for my use and it is going well.
I tried the other example, but it did not work well in the field.
Thanks,
Chris
|
|
|
|
|
Hey again,
I'm animating an image across the screen. My problem is, it seems to studder as it moves across the screen. This gets more pronounced the faster I move the image. Is there any way to get nice smooth animation?
I'm using the DirectX animation example as my guide but it doesn't seem to be fixing the problem. Should I create a separate thread for setting the frame rate? That's really what I'm looking for. Some way to syncronize the framerate.
Thanks,
EvilDingo
|
|
|
|
|
have you tried looking into double buffering? or maybe vsynch? i havent done any work with directx, but those two things are prolly what you'll need..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
I have a database connection in one assembly, and I have a Crystal report in another Windows forms Application.
I want my Crystal report to access Database through the connection in first assembly.
Is this possible? Idea is to keep a single database connection.
Please Help !!!!!
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Still not up on assemblies and the other nicities of C# yet. If you can put up with C++ jargon though, it should work like this:
Instantiate the assembly. Pass the connection instance to the form app using the C# ref keyword, and store it with a member variable. It is my understanding, though I haven't tested it yet, that the member variable will persist as a reference (pointer?) to the original connection.
>>>-----> MikeO
|
|
|
|
|
hi,
i wuold like to draw charts in my application and after copy and paste charts under Excel or Word ...
is OLE a good way to search method to do my job ?
thx
|
|
|
|
|
Hi there,
I’m using a Win32 API dll, Winscard.dll, for which there is no current equivalent in the .NET Framework.
Several of the functions require the use of ByRef arrays, e.g. pointers, when calling the api function. From following the examples in MSDN, I am able to set up the pointers needed for the array, but am having difficulty setting the correct size of the pointer using AllocCoTaskMem.
The function I’m trying to call in Winscard.dll is SCardStatus. From the documentation, this is declared as:
LONG SCardStatus(
SCARDHANDLE hCard,
LPTSTR szReaderName,
LPDWORD pcchReaderLen,
LPDWORD pdwState,
LPDWORD pdwProtocol,
LPBYTE pbAtr,
LPDWORD pcbAtrLen
);
My function declaration in C# is thus:
[DllImport("winscard.dll")]
static unsafe extern int SCardStatus (IntPtr hContext, out StringBuilder szReaderName , ref IntPtr pcchReaderLen, out IntPtr pdwState, out IntPtr pdwProtocol, ref IntPtr pbAtr, ref int pcbAtrLen);
This uses an IntPtr “pbAtr” to receive the array.
I declare an array (emptyATRArray) to act as the original array:
private byte[] emptyATRArray = new byte[32];
And create another variable, “size”, based upon the size of this
int size = emptyATRArray.Length;
Using the template in MSDN as an example, I then create a pointer called “buffer” to pass to the function:
IntPtr buffer = Marshal.AllocCoTaskMem(Marshal.SizeOf(size) * emptyATRArray.Length);
I then call the function:
lngResult = cSmartCard.SCardStatus(lngCard, out strGetReader,ref intReaderNameLen,out intReaderState, out intReaderProtocol, ref buffer, ref retATRLen);
I am happy that the function has worked correctly, as the value of the pcbAtrLen variable, (retATRLen) has correctly changed from 0 (in this case to 13, the expected number of bytes for the particular smartcard), as well as the other ByRef integers.
To extract the values of the updated array, I create a new byte array called returnedATRArray of the size retuned to retATRLen (13), and copy all the values from the buffer to the this new array:
Marshal.Copy(buffer, returnedATRArray,0,retATRLen);
And free the memory:
Marshal.FreeCoTaskMem(buffer);
This then gives me a correctly sized array, which I can cycle through to extract the values:
strATR= new StringBuilder();
foreach (byte atrByte in returnedATRArray) {
strATR.Append (Convert.ToString(atrByte,16) + ' ');
}
Console.Write("ATR: " + strATR.ToString());
However, from cross-checking with another program, I know that the values returned to returnedATRArray are not correct. By fiddling with the parameters to AllocCoTaskMem, I can get different values out of the final array, so I assume that the amount of memory allocated here is crucial.
I’ve been unable to find a clear guide as to how to define the size of the block of memory for such operations. Could anyone help
Cheers
Toby
|
|
|
|
|
I need to do serial comms in C#; that is, I need to be able to open COMn and read/write it.
I would also like to be able to set the comm parameters (SetCommDCB and SetCommTimeouts) but this is not essential.
How can I do this?
(I'm fully familiar with doing the same kind of stuff in C++).
tia
Phil
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|