|
Do you know of any good articles about creating a custom control like that?
Illegal Operation
|
|
|
|
|
hi everyone,
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
namespace arraylist
{
public struct ParameterValues
{
public ArrayList al;
};
public class Program
{
public static ArrayList alMix = new
ArrayList();
public static ParameterValues pValue = new
ParameterValues();
public static void Main(string[] args)
{
pValue.al = new ArrayList();
pValue.al.Add(5);
pValue.al.Add("vgbd");
pValue.al.Add('d');
alMix.Add(pValue.al);
alMix.Add(pValue.al);
//Now i want to ACCESS the elements of alMix array list
Console.ReadKey();
}
}
}
in the above program i have created an array list inside the structure and populated it.
The contents gets saved as,
pValue.al[0] = 5
pValue.al[1] = "vgbd"
pValue.al[2] = 'd'
Then i copied those values in another array list alMix where it is getting stored as.
alMix[0][0] = 5
alMix[0][1] = "vgbd"
alMix[0][2] = 'd'
alMix[1][0] = 5
alMix[1][1] = "vgbd"
alMix[1][2] = 'd'
Now since the alMix arraylist is 2D, i'm unable to access it. Please help in accessing the elements of the alMix array list which is 2-dimensional.?
thanx in advance.
|
|
|
|
|
A) No one uses Arraylists any more.
B) Try alMix[0].al[0]
C) Try ((Arraylist) alMix[0]).[0]
|
|
|
|
|
List cannot be 2D, Array can
ArrayList[] ai = new ArrayList[2];
ai[0] = new ArrayList();
ai[1] = new ArrayList();
or
ArrayList ai = new ArrayList();
ArrayList childai = new ArrayList();
childai.Add("MyName");
ai.Add(childai);
string name = ((ArrayList)ai[0])[0].ToString();
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi to all!
I'm using a PPP to connect two Gsm Devices through serial port. When i receive data from remote device, some characters are randomly appearing. I've been reading some documentation about those XonXoff characters, but i don't know how to deal with them. There's any way of avoiding those characters or to make my program correctly interpret them?
Best regards.
|
|
|
|
|
Hi,
Serial communication needs a way to prevent more data coming in than can be handled, the solution is called "handshaking" which basically is the receiver asking the transmitter to stop/resume sending. In Windows handshaking is handled by the driver, the application is not involved apart from selecting it.
when using "software handshaking" you set SerialPort.Handshake to Handshake.XonXoff and the serial driver will process the ASCII characters Xon and Xoff in a special way: it will send Xoff to indicate it can not accept any more data (buffer almost full), and Xon for the opposite.
The advantage is you don't need two extra lines to do "hardware handshaking".
There is one important limitation: you are not allowed to send data that contains Xon and Xoff characters;
if these occur they will be interpreted by the driver at the receiving side (probably interfering with the handshake), and they will not reach the application, so they are lost.
BTW: the normal values for Xon and Xoff are CTRL/Q and CTRL/S; the Windows driver allows you to select different characters for these, AFAIK the SerialPort class does not.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:13 AM
|
|
|
|
|
Hi,
1) Is it possible to add additional textbox control (or a button) to all open/save file dialogs in winXP and vista?
2) Is it possible to replace them with my application?
Regards,
Gilvini
|
|
|
|
|
|
C# and C++ might not have the same solution!
|
|
|
|
|
So you're writing a C# AND a C++ app that both need the same thing ? Really ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
You would have to create your own form that looks like a save dialog box.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
Thanks for you quick answer! I'll appreciate if you could explain how do I replace the standard windows open file dialog (in other application such as office, IE etc.) with my form? is there a common dialog that I replace?
Regards,
Gil.
|
|
|
|
|
There is a standard dialog. You can extend that standard dialog, the common examples on the web do stuff like add an image preview. But the person who responded said to write your own dialog. So, yes, there is a common dialog, the OpenFileDialog. He's saying you should write your own tho.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Member 4179230 wrote: 1) Is it possible to add additional textbox control (or a button) to all open/save file dialogs in winXP and vista?
No. They are called "common dialogs", but there's lots of them, in lots of different versions. The old-style dialogs of Win95 are still supported by XP and Vista, since they need to be able to run applications that are designed for XP and Vista. The installed applications don't use the "same" library for showing their dialogs - and some developers indeed rolled their own.
There is no way that you can replace all the Open/Save file dialogs in Windows. Office 95 uses a somewhat different version than Win95, Office 2000 has it's version, bla bla..
Then there's the Remote Desktop-variants where there's no actual "dialog" built with controls, but merely a form with a bitmap that sends and receives keystrokes/mouse-information.
You can modify any existing Window in Windows, using Windows Messages. One can hook deeply in the system, even change the text on the start-button using VB6. Thus doesn't mean that's a good idea.
Member 4179230 wrote: 2) Is it possible to replace them with my application?
Noes, and you should be happy about that - it means that virusses can't do it either
I are troll
|
|
|
|
|
Hello,
I would add five zéros on the left of int, like this :
1------------->0000000001
345----------->0000000345
65576--------->0000065576
How i can make this? thank you verry mutch.
|
|
|
|
|
int number = 1;
string numberString = "00000" + number.ToString();
MessageBox.Show(numberString);
Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|
|
i would take the same numer of caraters, if i make this for the int 3456+"00000", there are 9 caracters, thank you verry mutch.
|
|
|
|
|
I think the best way to do this is with a custom formatter, that way you'll be able to reuse it. Google it.
I think what you're looking for though is this:
class Program {
static void Main(string[] args) {
Int32 number = 234;
String s = number.ToString().PadLeft(9, '0');
Console.WriteLine(s);
Console.ReadLine();
}
}
Scott P
"Simplicity carried to the extreme becomes elegance."
-Jon Franklin
|
|
|
|
|
There are many, many ways...
What you want to do according to your question:
"00000" + number.ToString()
or
number.ToString("'00000'0")
or
string.Format("'00000'{0}", number)
or
new String('0', 5) + number.ToString()
or
number.ToString().Insert(0, "00000")
What you want to do according to your examples:
String.Format("{0:0000000000}", number)
or
number.ToString("0000000000")
or
number.ToString().PadLeft(10, '0')
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
wow... I just thought 2 from these.
|
|
|
|
|
Add the number "1000000000" to the int, that would give you this;
1------------->10000000001
345----------->10000000345
65576--------->10000065576
Now, convert them to a string, and loose the first character. That would give you these strings;
10000000001------------->0000000001
10000000345------------->0000000345
10000065576------------->0000065576
Enjoy
I are troll
|
|
|
|
|
Interresting solution. I overlooked that one.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
|
There sure are some interresting solutions. Here's an almost completely useless way of doing it:
String.Join(null,number.ToString().ToCharArray().Reverse().Select(c=>c.ToString()).Concat(new int[10].Select(i=>i.ToString())).Take(10).Reverse().ToArray())
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|