|
i know what a for loop is i was just hoping there was someway to peek at the next char in a foreach and advance the loop when i needed to for ease i guess
|
|
|
|
|
Please refer to the code...hope u get some clue:
string temp = "ABCDEFGHIJ";
System.Diagnostics.Debug.WriteLine("for loop output");
for(int i = 0; i < temp.Length; i++)
{
char c = temp[i];
System.Diagnostics.Debug.WriteLine(i + " place char = "+ c);
}
System.Diagnostics.Debug.WriteLine("foreach loop output");
int j = 0;
foreach(char c in temp)
{
System.Diagnostics.Debug.WriteLine(j + " place char = "+ c);
j++;
}
|
|
|
|
|
I need a solution for reducing or removing the flicker in the user controls (some controls I made) ... I'm seeking an effectient way; so please if anyone know how to do it, please tell me ...
NOTE : I have already used the DoubleBuffer Style and still got some sort of flicker ... The controls are drawn from A to Z so it continue flickering and flickering ...
Thanks for your time ....
|
|
|
|
|
For the control's painting have you used Graphics from PaintEventArgs ?.
like for form Paining.....same as below code.
private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Graphics g = e.Graphics;
g.DrawString("Happy X-Mas", this.Font, Brushes.Blue, 0,0);
}
Note: If you DONOT use Graphics from PaintEventArgs , there will always reamin flickering, I had the similar problem once, I solved it using the above approach.
|
|
|
|
|
I'm using the graphics supplied as a parameter in the OnPaint ; What really makes the control filkering more and more, is its nature as a container (such as the panel), When the control is drawn without any children controls, it works very good but when adding the children controls, it starts flickering in an unacceptable fashion ... Thanks for helping but I stell need some more IDEAS ...
|
|
|
|
|
This is the piece of code in Early Binding and works as expected.
---------------------------------------------------------------------------
using
ControlLicenseService LicenseInfoClient lic =new ControlLicenseService LicenseInfoClient();
lic.Initialize("sk26901CODA904O",10300);
if (lic.IsSuccess )
{
MessageBox.Show("Success");
}
else
MessageBox.Show("Failure");
This is my code in Late binding:
------------------------------------
Assembly asm = null;
Type PublishType = null;
try
{
string strPath = GetInstalledPath();
asm = Assembly.LoadFrom ("c:\\somefile.dll");
PublishType = asm.GetType("ControlLicenseService.LicenseInfoClient");
Object theObj = Activator.CreateInstance(PublishType);
// Array with Two members for passing the Parameter for Initialize method.
Type[] paramTypes = new Type[2];
paramTypes[0]= Type.GetType("System.String");
paramTypes[1]= Type.GetType("System.Int32");
// Get method info for Initialize( )
MethodInfo InitializeInfo =
PublishType.GetMethod("Initialize",paramTypes);
// Fill the array with the actual parameters
Object[] parameters = new Object[2];
parameters[0] = "sk26901CODA904O";
parameters[1] = 10300;
InitializeInfo.Invoke(theObj,parameters);
PropertyInfo pi = PublishType.GetProperty("IsSuccess");
string valu = pi.GetValue(theObj,null).ToString();
MessageBox.Show(valu);
}
Does there are any exceptions in reflections? What I found thru debugging was the parameters are setting properly n the late binding but the method is not invoked properly or it fails in the method.
Any idea ? or is the code wrong?
|
|
|
|
|
Sometimes I can associate file extensions with my application (a C# form based application), and sometimes I can't . And worse - I can't figure out what I change to lose or gain this capability.
Specifically what I'm referring to is being able to click on a file in explorer and have explorer start my application if the file extension is jpg. Sometimes I can right click on jpg files, select "Open With" and then "Chopse Program ..." and then browse to my program, select it - and - sometimes this works, and sometimes it doesn't. Anyone know what I'm missing?
Also, even when it does work, I only see the icon show on the list of applications that I can associate a file extension with - the name of the application has never shown up.
|
|
|
|
|
Hi guys...
Im have this assignment that i have to do for my computer network class, i have to write a simple program that simulates any rounting algorithm, so if anybody got an idea? or a code for this i'd be grateful because im running out of time anyways any help will be greatly appreciated.
Aws Al Attar
|
|
|
|
|
Google, man, Google!
http://computer.howstuffworks.com/routing-algorithm.htm[^]
Oh thats Dijkstra's alg & comp? OMG this is not difficult...
Or did you really think somebody from here will code it instead of you? (hell no)
One saying says "there are no dumb questions..." hmm
think man, think!
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
thanks for the reply man...
i know dijkstra is an easy one but everybody is doing it... and i need some visual effects on the simulation... i tried another software packages, but i really need time.. and its the end of the term and i have 3 projects to deliver thats why i asked for help anyways... i will try to find a simple and easy way to do it easy and fast...
take care
Nothing
|
|
|
|
|
Hello,
For example the TabControl, if you select it, in the property window, under all the properties theres also a section where you can click on "Add Tab". I want to know how to add such link(buttons) to your user control. I got a tips on DesignerVerbs and I made this:
public virtual System.ComponentModel.Design.DesignerVerbCollection Verbs
{
get
{
verbs = new DesignerVerbCollection();
verbs.Add(new System.ComponentModel.Design.DesignerVerb("&Add Section", new EventHandler(OnAddSection)));
return verbs;
}
}
private void OnAddSection(object sender, EventArgs args)
{
System.Windows.Forms.MessageBox.Show("The first designer verb was invoked.");
}
but I'm not sure thats it, because now another property is added under misc called Verbs with a collection as value. Not what I wanted.
Tips and code is appreciated!
Thanks in advance!
~~~~~~~~~~~~~~
Martin Lundberg
Student, Sweden
I have to thank every member of the Code Project for making it such a great place for a beginner to learn!
|
|
|
|
|
odsby wrote:
I am unable to compile and build spart parser (spart_src.zip) by Jonathan de Halleux, written in C#.
In a case like this you should contact the author directly (best would be to use the article discussion board). Anyway, the article you're talking about has been updated on 2003-12-23 and there is a confirmed message on the article discussion board from 2003-12-26 that the build is broken. So it seems there is no complete version on CP right now. Also the web site mentioned by Jonathan seems to be down.
Best regards
Dennis
|
|
|
|
|
Thanks. I will wait for the updates.
Surya
|
|
|
|
|
I need to get the Coordinates of the x-Axis from the Joystick. I already installed the DirectX SDK but I really couldn't find out how I do this.
Are there some good tutorials around or can someone tell me how it works? That would be grrreat
|
|
|
|
|
|
Hello.
How to detect when new device (disk) is added ?
How to do things, those described in "Detecting Media Insertion or Removal" in MSDN, but using .NET C#?
Thank you.
|
|
|
|
|
delemur wrote:
How to do things, those described in "Detecting Media Insertion or Removal" in MSDN, but using .NET C#?
Check this out: Trapping windows messages[^]
Best regards
Dennis
|
|
|
|
|
I create a web service with an DelItem() method to delete a record of a table in SQL2000 database via a store procedure.
It works correctly itself but when i call it in my web app. an error (UNAUTHORIZED) occurs.
Whats the problem?
---------------------------------------------
Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
Source Error:
Line 59: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/webservice/wsns/delitem",RequestNamespace="http://localhost/webservice/wsns",ResponseNamespace="http://localhost/webservice/wsns",Use=System.Web.Services.Description.SoapBindingUse.Literal,ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 60: public string delitem(short code) {
Line 61: object[] results = this.Invoke("delitem", new object[] {
Line 62: code});
Line 63: return ((string)(results[0]));
Source File: D:\Inetpub\wwwroot\WebApplication\Web References\localhost\Reference.cs
Line: 61
------------------------------------
thanks alot
|
|
|
|
|
How can I find he the x and y location of a window if I have the handle to it? Also how can I get the x and y size of it?
/\ |_ E X E GG
|
|
|
|
|
I don't know what you mean by "If I have the handle to it," but use this code (examine the comments!!!). place this code in the Form1_Load event( yes, all of it)
string x = this.Location.X.ToString();<br />
string y = this.Location.Y.ToString();<br />
string height = this.Height.ToString();<br />
string width = this.Width.ToString();<br />
textBox1.Text = x;<br />
textBox2.Text = y;<br />
textBox3.Text = height;<br />
textBox4.Text = width;<br />
|
|
|
|
|
thanks, but I mean any window that is not YOUR program. Say for istance... The MSN Messenger window. How can I find the x y location and the x y size of it??? What I'm ultimatly trying to do is, take a screen shot of a window, and have it displayed to my form. Although, I am having trouble finding the code... it seems so simple. I will even provide the handle!!
/\ |_ E X E GG
|
|
|
|
|
|
eggie5 wrote:
How can I find he the x and y location of a window if I have the handle to it? Also how can I get the x and y size of it?
I agree with Stefan that you could use GetWindowInfo()[^]. However since the only information you were asking for is WINDOWINFO.rcWindow you could also just call GetWindowRect()[^].
[DllImport("user32.dll")]
static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
Best regards
Dennis
|
|
|
|
|
Hi, I'm bruno
I need a help because, I don't know how play to mp3 files in C#.
How I do it?
thank's.
bruno
|
|
|
|
|