|
Perhaps you could try passing the array as a parameter:
private A[] myArray;
void Main()
{
myArray = new A[10];
FunctionB(myArray);
}
void FunctionB(A[] array)
{
...
array[i] = new A();
...
}
That should work.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
To: The Undefeated
void FunctionB(A[] array)
{
...
array[i] = new A();
...
}
There has 1 error like this:
"Error 1 Inconsistent accessibility: parameter type 'Project_1.A[]' is less accessible than method 'Project_1.Form1.functionB(Project_1.A[])'"
I wonder that after calling functionB(A[] array), all array[i] will be lost. So how to reuse them?
Thanks for replying.
|
|
|
|
|
i`m beginner wrote: I wonder that after calling functionB(A[] array), all array[i] will be lost.
No, they will not be lost. See my previous reply.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
C'mon, read the error, figure it out! You need to make the function at least private, perhaps public.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Hi
can you provide the exact error message you're getting? it's hard to say what's wrong since we don't see what's happening in the dots (...). maybe with an error message we could help you better
greets
M@u
|
|
|
|
|
To: M@u: Here it is:
Error 1 Inconsistent accessibility: parameter type 'Project_thu.A[]' is less accessible than method 'Project_1.Form1.addVertex(Project_1.A[])' F:\Project_1\Project_1\Form1.cs 74 21 Project_1
|
|
|
|
|
well THIS error is because you have a public method that takes a private (or internal) type as parameter. they must have the same visibility.
let's say you have this situation here:
public class myFirstClass
{
private class errorCausingParamClass
{
}
public void SomeMethodThatGeneratesCompilerError(errorCausingParamClass[] Parameter)
{
}
}
changing the code to this wil solve it:
public class myFirstClass
{
public class workingParamClass
{
}
public void SomeMethodThatGeneratesNoCompilerError(workingParamClass[] Parameter)
{
}
}
but the way i understand your first post, that was not your initial problem..?
|
|
|
|
|
Yes, My first problem is i don't know how to keep the object alive until the program is finished ignore it's scope.I mean is there using any key word?
Thanks for replying.
|
|
|
|
|
hmm.. i think i know now that you want
you want to have some kind of global variable that is accessible from anywhere in you application.
the easiest way to achive it is to do the following:
public class Global
{
public static myClass PublicMember;
static Global()
{
}
}
doing this you can do this call from wherever you want:
Global.PublicMember.DoSomething();
the static constructor is called automatically before DoSomething is executed for the first time.
does that help?
greets
M@u
|
|
|
|
|
Hello,
I want to make an app that compares an image with other images stored in a folder.
More exactly the main image is an multiple choice test solved correctly and the images stored in the X folder are the tests solved by students.
I want the app to be very flexible so i was thinking at defining an area that corresponds to the correct answer and so on for every question and save the coordinates of the area in an text or XML file. Then i can import the saved areas and assign them to every solved paper and check if the number of pixels in the correctly solved paper is (<, =) then the nr of pixels in the paper.
Can you suggest me some classes or anything that might be useful??
Thanks!
|
|
|
|
|
I will show you how to compare the image in C#. ( but the way you wanna use is very strange for me..)
Stream s1,s2;<br />
<br />
<br />
if (s1.Length != s2.Length)<br />
{<br />
return false;<br />
}<br />
s1.Position = s2.Position = 0;<br />
for (int pos = 0; pos < s1.Length; pos++)<br />
{<br />
int byte1 = s1.ReadByte();<br />
int byte2 = s2.ReadByte();<br />
if (byte1 != byte2)<br />
{<br />
return false;<br />
}<br />
if (byte1 < 0) break;<br />
}<br />
return true;<br />
<br />
hope it helps.
|
|
|
|
|
I am working on Window application of Visual Studio 2.0. I want a check box column and a check box in the header of this column in a DataGridView. Later, on clicking this header check box all the corressponding check boxes should be selected or deselected as well and values of two other columns should also interchanged between them. This interchange of column values should also heppen if we checked the single check box.
Please help me out.
Thanks,
Sumeet Sharma.
-- modified at 23:53 Wednesday 7th November, 2007
|
|
|
|
|
ImageFormat format = ImageFormat.Jpeg;
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "JPEG Files(*.jpg)|*.jpg";
if (sfd.ShowDialog() == DialogResult.OK)
{
image.Image.Save(sfd.FileName, format);
}
Hai friends whrn i was using this code fro saving picture box image as jpeg it was not saving and if save and reopen the jpeg file it was balnk can any one help me out in this
|
|
|
|
|
Code looks fine. Are adding any file extensions with the file name ? Try setting sfd.AddExtension = true; .
|
|
|
|
|
Hmm, odd. Are you sure you havn't set the BackgroundImage property of the picturebox by mistake?
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Hi All,
I have a datagridview populated from a database.
i want to place a option box on the grid saying Yes/No for each row and based on the selected option box i want to populate a combobox for that row.
suppouse if yes option is selected than Combobox has values (1,2,3)
Ahmad Osama
|
|
|
|
|
Hi,
I want to create one MSI Package with following requirement
1)There should not be any entry in Add Remove entry, Control Panel
2)The MSI package should use ASMFlag.sys file in C root to determine if the agent is installed or not. If file exists, do not install. If file does not exist, install.
3) When MSI package is created, the EXE will reside in a subfolder named 'temp'.
This is very urgent requirement. Please suggest how to create MSI Package.
Thanks in Advance
|
|
|
|
|
hi frns i want to know how to exit of web application when i click on the button like application.exit(); in windows application can anybocy tell me what is the code i can write under button click event.
regards
sunil
|
|
|
|
|
To do what? Close the web browser, or end the users session? If it's the web browser, use window.close() * in the client javascript. If the session, the code behind should use Session.Abandon(); .
*If the window hasn't been opened from another browser, it won't close without prompting the user.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
thanks for u r reply but i want to close the whole window that too in code behind
|
|
|
|
|
i got the solution iused the code below
Response.Write("javascript: parent.opener=''; " +
"parent.close();");
|
|
|
|
|
Hi,
I have created two projects, One is an EXE and other one is DLL. The DLL is referanced by EXE Project. The Exe & Dll Are working fine.
I Need to hide code of dll. So I use .NET Obfuscator Community edition (Which comes with VS 2005) to Obfuscat dll. It was done successfully.
The problem is Now when I am executing Exe it generate errors about missing Classes (Those classes are Withing DLL)
What can I do for this scenario ? Is it the nature of Community Edition ?
Please help me to solve this problem.
Thanks
Dinesh
|
|
|
|
|
Are you using reflection to load those classes? I don't think the community edition is any good for this type of situation.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Thats correct. I use reflector to see the binary. Then What can I Use for this ?
Thanks
Dinesh
|
|
|
|
|
Take a look at the ObfuscationAttribute in the System.Reflection namespace.
Deja View - the feeling that you've seen this post before.
|
|
|
|