|
Hi. I create a usercontrol. It's name is Imagelists and it holds images as a list. And it has indexer property as
public Image this[int i]
when i use it in an event as Imagelists1[2]. i want to see the second image name as a property. when i call Imagelists1[3].Name, let it returns me the name of image. But i couldn't see the Name property when i use it with it's indexer. if i don't use indexer an i use like ImageLists1.Name, i can see the Name property. I just want to see like Imagelists1[3].Name and it returns me the name of 3rd image. How could i do this?
|
|
|
|
|
Hello,
I have a problem in my application and I don't really know how to solve it:
unsafe public System.Collections.IEnumerator GetEnumerator()
{
char[] sString1 = new char[max];
for (int numer = 0; numer < roz; numer++)
{
fixed (char* sString = sString1)
{
for (int i = min; i <= max; i++)
{
string a = brute(sString, 2, sString1, numer);
yield return a;
}
}
}
}
private string brute(char* sString, int nLen, char[] sPoczatek, int num)
{
while (nLen > 0)
{
if (nLen == 1)
{
for (int i = num; i < zn.Length; i += roz)
{
sString[0] = zn[i];
brute(sString + 1, nLen - 1, sPoczatek, num);
}
}
else
{
for (int i = 0; i < zn.Length; i++)
{
sString[0] = zn[i];
brute(sString + 1, nLen - 1, sPoczatek, num);
}
}
}
return sPoczatek.ToString();
}
Error 1 Unsafe code may not appear in iterators
Is that possible to use GetEnumerator() with unsafe code?
111
modified on Sunday, February 22, 2009 11:38 AM
|
|
|
|
|
hii all
i want to only authenticate windows live id / hotmail in c# windows application.
i dont want to send emails. pls help
thanks in advance.
|
|
|
|
|
|
Hi dears.
I'm going to save a string in a DOC file in a specific format.
Could you tell me how I can do it ?
Thanks in advance.
|
|
|
|
|
help me please i 'm in an urgent situation,
i have 2 project in my solution ,i refrance the B project with A project,
i run the project and use it whitout any error,but when i try to publish
an unexpected error unleashed as below :
"Error 159 Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'.project"
what can i do, i'm runing out of time,help plz!
|
|
|
|
|
Its a bug in VS 2005
http://support.microsoft.com/kb/907757[^]
more info[^]
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,
In my program, serialport.Ctsholding and serialport.RtsEnable are used every second to check signal input. serialport.Datareceived is used to receive different data. It seems that they have conflict with each other. When Ctsholding and RtsEnable are being used,datareceiving is affected in time wise.
Any suggestions why this happens and how to solve the problem? If required, I can put up my codes.
Thanks in advance.
Charles
|
|
|
|
|
http://technet.microsoft.com/en-us/library/ms187320.aspx[^]
I'm wondering if anyone has built this scheduler structure within their C# application. It seems very flexible. Essentially all I'm really looking for is a function to generate the Next_Occurance date and time from the other values given.
Has anyone tackled this?
Thanks.
|
|
|
|
|
I using datetimepicker and when i get the value that the user was choose i get the time with seconds.
This field is read only and i can do "get" but i cant do "set".
My problem is that i want to drop this seconds and i don't know how.
I try to avoid of create new DateTime object and with i parser this object to set the seconds to be "00".
Thanks.
|
|
|
|
|
|
It depends on the specific control, but generally the format would be somthing like hh:mm....the default is hh:mm:ss, so drop the ss for dropping the seconds from displaying.
|
|
|
|
|
I already done it.
But still, when i do this:
DateTime t = DatetimePicker.Value;
==> the t.seconds is not 0.
I need that the t.seconds will be always 0.
|
|
|
|
|
dateTimePicker1.Value=dateTimePicker1.Value.AddSeconds(dateTimePicker1.Value.Second*-1);
|
|
|
|
|
I am trying to access a web service in Mule from a C# project in VS 2005. I have access to the web service and the methods within it, but am unable to access the fields within the response. The response from the web service is an array of objects, but I cannot seem to break into the objects.
I have added a Web Reference to the data service. An example of how I am using the reference follows:
dataService serv = new dataService();
dataService.MyData myData = serv.getMyData();
ArrayList responseData = new ArrayList();
int count = myData.firstData.Length;
string dataName;
for(int i = 0; i < count; i++)
{
responseData.Add(myData.firstData[i]);
dataName = responseData[i].Name;
MessageBox.Show(dataName);
}
Although Name is one of the fields in firstData, it is not accessible from firstData or from responseData. Java is accessing the fields through dto in Eclipse, but I do not appear to have access to those from my C# project.
Does anyone know of a way to access the Eclipse dtos from my VS project, or, barring that, is there another way to access the fields within the response object through my project?
|
|
|
|
|
responseData is type of ArrayList and its hold an array of object. So before you access the objects' properties stored in array list you need to cast it first.
e.g.
MyClass cls = responseData[i] as MyClass;<br />
dataName = cls.Name
|
|
|
|
|
Thank you. I am not certain that I understand what MyClass is supposed to be, though. Can you please explain?
|
|
|
|
|
The Queue Class documentation doesn't say if we can use the class for queueing data structures but I am guessing that as the struct is considered a data type it might be OK. Can anyone confirm or deny that?
Secondly, how do I define and instantiate the equivalent of this C structure in C#
struct ADRMSG {
long PGN;
byte PGNspec;
byte RxData[8]; <--- This is the confusing part for me
}
Thirdly, can I put this definition in a header file so that two seperate class files can enqueue and dequeue these structs from the queue?
Thanks for your patience with my newbie questions.
Cheers, Bruce
|
|
|
|
|
You can use a value type as T in a Queue<T> if that's what you were asking.
You can also use a fixed length array, like so: unsafe fixed byte array[8]; you'd have to turn on unsafe code, obviously.
You can Not put it in a header file, but you don't need to either. Just declare your struct public (on internal).
Last modified: 40mins after originally posted --
|
|
|
|
|
Yes, you can put struct values in a queue, but you probably should not use a struct at all in this case. A struct in .NET is a different concept from a struct in C. In .NET a struct is always a value type, while in C the struct is just a definition of the data and if it's a value type or reference type depends on how you use it.
Use a class like this:
public class AddressMessage {
public long ParameterGroupNumber { get; private set; }
public byte ParameterGroupNumberSpecific { get; private set; }
public byte[] RecievedData { get; private set; }
public AddressMessage(long number, byte specific, byte[] data) {
ParameterGroupNumber = number;
ParameterGroupNumberSpecific = specific;
RecievedData = data;
}
}
C# doesn't use header files at all, and class files are not compiled separately so you don't need header files to share definitions. As long as the class is in the same application, you can reach it by simply specifying the namespace where it is.
Despite everything, the person most likely to be fooling you next is yourself.
modified on Friday, February 20, 2009 4:20 PM
|
|
|
|
|
Thanks for the feedback everyone.
I am porting a C ap to C# and in the legacy code we have a file that handles packets of data that currently arrive as a structure from another file. I would like to pass data into the class file as a structure rather than by seperate set commands so that the data arrives as a combined packet. So am I still wrong to try and do this as a a queue of structs?
Cheers, Bruce
|
|
|
|
|
Yes, you can't read the data directly from the file as a struct anyway, so there is no reason to use a struct at all, use a class.
You can use a BinaryReader to read raw data from a file, but you need to read each value by itself.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Yeah, what they said.
Plus, yes, you can use a header file if you like (I do), but you don't need to and shouldn't.
|
|
|
|
|
PIEBALDconsult wrote: yes, you can use a header file if you like (I do)
I would like to know a little more about that.
TIA
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
|
|
|
|
|
I want to include the database in my setup file itself . i don't want to setup the database manually. So, how can i do it.
|
|
|
|