|
Jiju class is an inner class to Program in your example. Take a look at this [^] code. It is self explanatory of how inner classes work. You read also this [^]CodeProject article for more details.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
thankyou Andrei
one more doubt while i saw a code regarding functional overloading like this.....
class Program
{
int a;
int b;
int c;
public Program()
{
}
public Program(int x, int y)
{
a = x;
b = y;
}
public Program(int x, int y, int z)
{
a = x;
b = y;
c = z;
}
public oops jiju(int x,int y )
{
a=x;
b=y;
}
public void oops(int x, int y, int z)
{
a = x;
b = y;
c = z;
}
my doubts are here: public Program(int x, int y)
{
a = x;
b = y;
}
what is the purpose of a,b in this code......
i am a beginner with out null programming backing thats why i have so many questions ...sorry for the trouble
thanks again
jiju
j
|
|
|
|
|
Trustapple wrote: i am a beginner with out null programming backing thats why i have so many questions
First of all, if you are so new to programming start reading about OOP (Object Oriented Programming)
Trustapple wrote: my doubts are here: public Program(int x, int y)
{
a = x;
b = y;
}
what is the purpose of a,b in this code......
As you may have noticed, the "function" Program has it's name the same as the class...that means it's a constructor. In your example you have 3 constructors. One with no parameters
public Program()
{
...
}
One with 2 parameters
public Program(int x, int y)
{
...
}
And one with 3 parameters. In the last 2 constructor you store the values received as parameters into local variables. When you have 3 constructors you can create an object of Program type like this
Program obj = new Program();
Program obj1 = new Program(1,2);
Program obj2 = new Program(1,2,3);
For more details about overloading constructors...try Google.
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Hi All,
I am writting a C# project in which am using Browser Control. The object of this project to read values of JavaScript's variables values on the current page ,and add those values to ListBox control. Can anybody show me how to do this. Please help if you can I need to do this ASAP for my job.
Thanks,
Asif
A.Asif
|
|
|
|
|
Hi...
A.Asif wrote: to read values of JavaScript's variables
directly you will not be able to read the values of javascript variables, but to get values the possible solution is to create hidden fields in you application and store the values of the javascript variables into these hidden fields and finally in your code access those hidden fields and add the values into listbox control.
Regards,
Sandeep Kumar.V
|
|
|
|
|
Thanks for your help! I do understand hidden field part, however, I am not good with JavaScript, Can you please tell me how to get values into these fields from javascript.
Thanks,
Asif.
|
|
|
|
|
here is the example....
<html><br />
<head><br />
<script language="javascript"><br />
function fun1()<br />
{<br />
var testvariable="testdata";<br />
document.forms[0].hid1.value = testvariable;<br />
}<br />
</script><br />
</head><br />
<body><br />
<form><br />
<input type="hidden" name="hid1" id="hid1"><br />
<input type="button" Name="but1" id="but1" onclick="fun1()><br />
</form><br />
</body><br />
</html>
Regards,
Sandeep Kumar.V
|
|
|
|
|
|
hi all.
I have a service with multi threads and i want to debug a specified thread but not have to wait the others. I'm a new newbie. Please help me with this problem. I've spent much time with it but get no result.
Many Thanks!
|
|
|
|
|
Hi!
Are your threads executing the same piece of code or are you using different threads for different tasks?
Anyway, if you attach VS to the service process and have a breakpoint at the appropriate position, it should work. In addition, you can make breakpoints conditional, so perhaps you can tell VS to break only for a given ThreadID...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I need a function that launches a text file in the users default text editor. It would be easy enough to launch notepad, but notepad is horrid. How to I grab the executable that is used for the .txt extension. I assume this is a registry thing, and I have avoided the registry in the past.
Thanks.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
You use Process.Start and pass it the path to your txt file. It's probably going to open notepad.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, if you pass a .txt file as the command to Process.Start() it will be opened by
whatever app is associated to the .txt extension (which could be Notepad of course).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Both of you THANKS! and DUH on me.
Many users will have notepad, but I know the particular user I am dealing with uses textpad. I wanted it to just call whatever is associated.
Thanks again.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
I'm so new to AD it's not even funny What I'm trying to do is export all the users and there information to my application and then use that information to create accounts in another app. First question, is the directory in XP the same as Server? I ask this because if I'm righting this app in XP can I test it there (again so new to AD)? Next, I have checked for some examples of how to do this but just don't understand the LDAP connection at all. Could anyone lead me to some very VERY simple examples that would work with XP? Even some books that you would recommend is good too. Thanks so much!
|
|
|
|
|
I never worked with AD before about 2 weeks ago, and got thrown into a somewhat similar task. It is actually very easy to work with once you get the concepts down. Let me find the links to the resources I used. They were very simple, and good for a self starter, as they had some complex problems in there that can be picked up quickly. I'll modify this post once I find them
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
Oh thank you so much man! I'll wait
|
|
|
|
|
I am having a hard time finding the articles. I'm still looking, but here is a couple simple code snippets. Maybe they will give you somewhere to get started.
This code will get a Full name for a user from ADS.
public static string getFullName(string sUserAndDomain)
{
string u = sUserAndDomain.Replace('\\', '/');
try
{
DirectoryEntry e = new DirectoryEntry("WinNT://" + u);
return (string)e.Properties["FullName"].Value;
}
catch (Exception)
{
return null;
}
}
But to get that you need the User & Domain name of the logged in user. Below is the code
public static string getCurrentUsernameAndDomain()
{
WindowsIdentity user = WindowsIdentity.GetCurrent();
return user.Name;
}
I normally don't like giving out code like that, and I'm sure some people frown upon it. But, it's pretty simple and maybe that will get you headed in the right direction. If I can find those articles I'll post here. Hope that gets you started!
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
|
|
|
|
|
I would like my form not to be "prone" for such shortcuts like win+d or win+m or any other minimize action.
When all other programs are minimized I would like my form stay visible on the desktop.
How can I do it? I've tried on other forums but noone could help me :-/
//sorry for my english but I'm not native english
regards
Y.
|
|
|
|
|
There's an onWindowStateChanged event, which fires after the window has been minimized / restored / maximized. If it gets minimized you can just restore it again imediatly.
Although your window may minimize them maximize straight away, rather than just staying where it is. Im not sure, you should check it out.
Wait... did i just imagine this event... i can't seem to find it... oh well, the location changed event catches minimizing too, use that
Oh, and your english is just fine.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
Thanks indeed.
I'm going to try this.
But it can be visible when form is "returning" from minimize state. But this may be the only way to solve this problem...
|
|
|
|
|
Infact, i've just remembered a much more reliable way of stopping your window from minimizing / maximizing / whatever. You can override the message in WndProc:
protected override void WndProc(ref Message m)
{
switch(m.Msg) {
case 0x112:
if(m.WParam == (IntPtr)0xF032 || m.WParam == (IntPtr)0xF020)
m.WParam = (IntPtr)0xF122;
break;
}
base.WndProc(ref m);
}
That should disable any such resizing of your form, whether it be by clicking, shortcuts, or magical powers, of course if you want to maxmimize the form, just take out the first part of the IF statement.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
That's it!
Thanks
//edit:
that code doesn't work with win+d. When I press win+m all windows are minimizing and my form is still on the desktop. But when I press win+d all windows hide. But when I click any window on the taskbar (eg. IE, mozilla or any) my form is visible again.
Any idea?
Maybe I should catch event of pressing win+d and restore my form again...?
//edit2:
Option in the taskbar context menu "Show Desktop" affects my form too. It's the same as pressing win + d :/
-- modified at 11:33 Tuesday 16th October, 2007
|
|
|
|
|
Same issue here. I'm trying to figure out how to prevent Win+D or "Show Desktop" from working on a specific form. In other words, I need a form that is unhidable.
|
|
|
|
|
Found it! This will disable minimization and "hiding" for a form by attaching it to the desktop (or progman, technically). Here's the code in C# (should be easy to adapt)
<br />
[DllImport("User32", SetLastError = true)]<br />
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);<br />
<br />
[DllImport("User32", SetLastError = true)]<br />
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);<br />
<br />
public static void AttachFormToDesktop(Form frmToAttach)<br />
{<br />
IntPtr desktopHandle = FindWindow("Progman", null);<br />
IntPtr result = SetParent(frmToAttach.Handle, desktopHandle);<br />
}<br />
One problem I've encountered so far, though, is that I can no longer set the TransparencyKey property on a form that's been attached to the desktop.
Hope this helps someone!
|
|
|
|