|
If you are not familiar with C# language, don't read "CLR via C#.". This book won't be right for you.. This book is for those who already familiar with C#. You should probably read "Beginning with C#" or something like that until you get used to it..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
"Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."
|
|
|
|
|
hi.. i got a problem creating a treeview which enables user to upload a photo/movie/sound clip through the uploading function and the data will be displayed in the treeview....
what i found on the tutorial is just regarding the treeview arrangement with child nodes...
i can do a function to upload a picture.. but how about movie? and songs clips..
|
|
|
|
|
alainlyehongloon wrote: the tutorial
What tutorial?
|
|
|
|
|
oh.. sorry.haha. i want to upload a file and the file will be displayed in the treeview categorized by year... how do i do that
|
|
|
|
|
Hi Friends,
I have an array whose members are below
int[] sayilar=new int[10]
sayilar[0]=2;
sayilar[1]=3;
sayilar[2]=5;
sayilar[3]=3;
sayilar[4]=2;
sayilar[5]=2;
sayilar[6]=5;
sayilar[7]=3;
sayilar[8]=7;
sayilar[9]=8;
I want to send these the members of sayilar array to sayilar2 array but one member can be sent to sayilar2 array only one time. For example, 5 is repeated two times in sayilar array but sending to sayilar2 array it must be only one time.
|
|
|
|
|
omegazafer wrote: I want to send these the members of sayilar array to sayilar2 array but one member can be sent to sayilar2 array only one time. For example, 5 is repeated two times in sayilar array but sending to sayilar2 array it must be only one time.
That doesn't hold much meaning now does it?
Did you mean that you wanted to copy only a single instance of the elements in sayilar to sayilar two?
Please rephrase.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
Yes, you understood truely, I meant that.
|
|
|
|
|
Are you required to use arrays? Could you use another alternative dynamic data structure like a List<t> ?
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
Firs of all, I prefer array but if you have only solution on list. You can explain.
|
|
|
|
|
The problem with arrays is that they are static in length. Once declared they can't be grown or shrunk unless you re-declare them. So in the first problem (2 arrays) assuming you copy an element from the first array to the second array and then after you have made a copy you check to see if there are any repetitions you will encounter gaps as such:
aray1: |0|1|2|3|2|5| array2: |0|1|2|3| |5|
so unless you waste extra loops to filter out the gaps into a 3rd array, you can't do much.
With a dynamic data structure such as a list, the following answers your problem:
<br />
array2 = new List<int>(array1);<br />
<br />
int repitionCounter = 0;<br />
for (int i = 0; i < array1.Length; i++)<br />
{<br />
for (int j = 0; j < array2.Count; j++ )<br />
{<br />
<br />
<br />
if (array2[j] == array1[i])<br />
{<br />
repitionCounter++;<br />
}<br />
<br />
if (repitionCounter > 1)<br />
{<br />
array2.Remove(array2[j]);<br />
--repitionCounter;<br />
}<br />
}<br />
<br />
repitionCounter = 0;<br />
}<br />
or even better, since you should be taking advantage of the Class methods:
<br />
array2 = new List<int>();<br />
<br />
for (int i = 0; i < array1.Length; i++)<br />
{<br />
if (!array2.Contains(array1[i]))
array2.Add(array1);
}<br />
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
int[] sayilarTwo = new int[10];
int count = 0;
for(int i=0; i<10; i++) {
bool match = false;
for(int j=0; j<i; j++) {
if(sayilar[j] == sayilar[i])
match = true;
}
if(!match) {
sayilarTwo[count] = sayilar[i];
count++;
}
}
I just bodged that togeather, it will probably work.
There's also probably better ways to do it.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
thanks a lot, for you responses.
|
|
|
|
|
You might want to try and post this in the ASP.NET forum.
PLEASE reference this at all times when in the forums.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook
"There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib
"Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
|
|
|
|
|
Hi,
I'm writing a simple application which requires the user to log on. It displays a logon form and if the user passes the security check, the main form is then displayed.
On my logon form I have this:
static void Main()
{
Application.Run(new Login());
}
If the user passes security, I want the logon form to close leaving the main form open but can I do this? I can hide the form but if I close the main form, the application is still running.
Can anyone help?
Thanks
|
|
|
|
|
The trick is to show the dialog before the Application.Run. Trust me - it works. What you end up with is something like this:
static void Main()
{
using (Login login = new Login())
{
login.ShowDialog();
if (login.IsAuthenticated)
{
Application.Run(new MainForm());
}
}
} Of course, there are a couple of assumptions here. One is that your login form has an IsAuthenticated property, and the other is that your main form is called - well MainForm. Anyway, this should give you the general idea.
|
|
|
|
|
using( System.Diagnostics.EventLog evtLog = new System.Diagnostics.EventLog( ) )<br />
{<br />
evtLog.Source = "MyAppName";<br />
evtLog.WriteEntry( "SomeMessage" );<br />
}
Any reason why this would not work when the current user isn't an Administrator? If this is the case, what is the correct way to enable event logging for non-admins?
Regards,
Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
dabs wrote: Any reason why this would not work when the current user isn't an Administrator?
Yup. The sys admins have locked down your event log - you need to get them to open the privileges on them.
|
|
|
|
|
You can try using impersonation. Ask your administrator to help you with an account that is privileged to write to EventLog.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Hello everyone,
I am working on a Browser Helper Object and so far I have been able to hook to HTML document elements.
My question is, is it possible to hook to Flash Objects in the HTML? For example would it be possible to detect if a Button in Flash environment has been click?!
Any information on this would be great. Thank you and happy thanks-giving everyone.
Khoramdin
|
|
|
|
|
Hey all i need help in making an OCR software in C#. Currently i am on a basic stage and finding stuff from where to start i just have basic knowledge about OCR so if u guys have any references from where i can find appropiate information so tell me.
Vicky Shah
Vicky Shah
|
|
|
|
|
Here's a link[^].
Pay particular attention to items 2 & 3.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Hi everyone.
I just started developing a very simple mailchecker application, which runs in the background and checks for new e-mails on a certain account every 2 minutes.
Or, that was the plan. When the app connects to the POP3 server, it freezes immediately. Here's my code:
private void timer1_Tick(object sender, EventArgs e)
{
MailCheck.Connect("pop.sixhoej.net", 110);
NetworkStream NS = MailCheck.GetStream();
StreamReader SR = new StreamReader(NS);
StreamWriter SW = new StreamWriter(NS);
string output = SR.ReadLine();
if (output == "+OK Hello there.")
{
SW.WriteLine("USER [e-mail address goes here]");
System.Threading.Thread.Sleep(1000);
SW.WriteLine("PASS [password goes here]");
System.Threading.Thread.Sleep(3000);
SW.WriteLine("STAT");
System.Threading.Thread.Sleep(1000);
output = SR.ReadLine();
output = output.Substring(4, 2);
MessageBox.Show("You have " + output.ToString() + " unread mail(s)");
}
} Can you see anything wrong with this code?
Thanks in advance.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Dont use ReadLine. Your app will get stuck if the reply does not end in a newline.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
Thanks, it's working now.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|