DdoubleD 315 Posting Shark

Here is an even shorter way to begin clarifying what I don't seem to understand. Sorry about changing the second cells earlier--the coffee speeds up my typing, but apparently not my brain so much.;)

INPUT: "##" AND "__" AND ".."
OUTPUT: "_#" AND "._" AND "+."

Right?

DdoubleD 315 Posting Shark

INPUT: "####"
OUTPUT: "#_#_"

INPUT: "++++"
OUTPUT: "+#+#"

Sorry, I meant:

INPUT: "####"
OUTPUT: "_#_#"

INPUT: "++++"
OUTPUT: "#+#+"

DdoubleD 315 Posting Shark

I am not sure why this reply got posted twice, but see my other comment on it. Also, here are two short examples I would like you to explain if the output is wrong (use underscore for space):

INPUT: "####"
OUTPUT: "#_#_"

INPUT: "++++"
OUTPUT: "+#+#"

thanks for the reply..

i am not quite sure about what you mean.
but i can give more explanation and example.

Yes, i only need to change changeState at cell .
the rule goes through each cell from left to right.
If the rule is not applied to the cell, then the cell remains unchanged.

this is the example (i won't use the "space" (ignore the space) because it is hard to see in here, so let say we have 3 state, ".", "+", "#" --> "#" will go to "." as the next state)

example 13 cells in a row:
the first row: ##+#++#..#+.#
the result: ######. ... #+.

sorry if it is not clear

DdoubleD 315 Posting Shark

example 13 cells in a row:
the first row: ##+#++#..#+.#
the result: ######. ... #+.

OK, now I'm confused, so let's just stick to the input/output. Let's use underscore for the space character. In the above, I would expect for output to be: "#_+#+##.+#+.#". I don't understand how you started the output with "###", because I would think you be changing the second cell to be "_" or space given your ChangeState() method and that it is equal to the adjacent cell's "#". Where am I confused?

DdoubleD 315 Posting Shark

What I'm trying to say is that if you are only allowed to change each cell once, and the completed array must not have any adjacent cells contain the same value, and, you must change the left hand cell side of the comparison (reading left to right), then let me know that all of these rules are true and I will show you what to do. I just don't want to begin without knowing the exact requirements.

Oh... here is what I mean:

for (int i = 0; i < ARRAYSIZE-1; i++)
                {
                    if (Cells[i].DefaultCell == Cells[i + 1].DefaultCell)
                    {
                        do
                        {
                            Cells[i].ChangeState();
                        }
                        while (i > 0 && Cells[i].DefaultCell == Cells[i - 1].DefaultCell);
                        System.Diagnostics.Debug.Assert(Cells[i].DefaultCell != Cells[i + 1].DefaultCell);
                    }
                }
DdoubleD 315 Posting Shark

What I'm trying to say is that if you are only allowed to change each cell once, and the completed array must not have any adjacent cells contain the same value, and, you must change the left hand cell side of the comparison (reading left to right), then let me know that all of these rules are true and I will show you what to do. I just don't want to begin without knowing the exact requirements.

DdoubleD 315 Posting Shark

thanks for the reply.
But i already check, it is not the answer.

the problem is i need to change the cell state(that i want to compare) to the next state first.
after that compare it to the left and right, if either one of it is the same, then the current cell will be changed too..

012345
#. +

here it is..
cell 2 is "space", and the next state is "."
cell 1 state is ".", so it has the same state with the next state of cell 2.
So cell 2 will be changed to "."

i still don't know how to assuming that the cell is changing state first before i compare it to the neighbouring cells.


thanks.

Yep, just noticed that after rereading and was about to tell you what to do. Also, you can remove that unnecessary line that compares the cell to itself because I forgot too.

When comparing those two cells (left cell and right cell), if you change the left cell instead of the right, you have the possibility of still having same adjacent cell values, which I was not sure if was allowed scenario. If that is OK, then you need only change ChangeState at cell. If remaining same adjacent cells must be done, you will need a nested loop, or additional logic to compare three cells at a time.

DdoubleD 315 Posting Shark
string[] ar = listBox1.SelectedItems.Cast<string>().ToArray<string>();

Wanted to +rep you, but I guess I already did somewhere and it wouldn't let me. Anyway, that is a very clean line of code I haven't seen before--kudos! I hope I remember it the next time I do that.;)

serkan sendur commented: chic +8
kvprajapati commented: Thanks! +15
DdoubleD 315 Posting Shark

Assuming you are passing the rectangle of the control being edited to the custom edit control, you should just need to adjust Rectangle.Location Property. Be sure to create a clone of the rectangle before changing the location so you don't modify the original.

DdoubleD 315 Posting Shark

I think this is what you want, but you need to compare your random generated cells to see if you are getting the ChangeState on the proper cell because I modified the index on that too.

public void operation1()
            {
                for (int i = 0; i < ARRAYSIZE-1; i++)
                {
                    if (Cells[i].DefaultCell == Cells[i + 1].DefaultCell && 
                        Cells[i].DefaultCell == Cells[i].DefaultCell)
                    {
                        Cells[i + 1].ChangeState();
                    }
                } 
                PrintCell();

            }
DdoubleD 315 Posting Shark

Hi,
In my current project,
Am drawing a set of boxes, all at run time, and inside them i have called few bitmap images for each box, this also happens at run time.
now i need to click that image, the image should be selected and that image shud appear as if the pixels are inversed.
HOw do i create a button click event for that image which is been called at run time..?

Plz help me out with this...

thanks in advance...

If you are creating a control (like PictureBox ) for each of the set of boxes, then you could create one click event that is wired to each of the controls at runtime:

void HandleMyBoxes_Click(object sender, EventArgs e)
        {
            PictureBox pb = sender as PictureBox;

            // .... Code to Invert the pb.Image
        }

        void CreateBox(Point pt)
        {
            PictureBox pb = new PictureBox();
            
            //.... Code to Add your bitmap object and position your control

            // Add click Event at runtime
            pb.Click += new System.EventHandler(HandleMyBoxes_Click);
        }
DdoubleD 315 Posting Shark

What is the definition of object Cell ?

Inside method operation1() :
1) You hardcoded 19 in your loop when you should use ARRAYSIZE-1 2) Where is the beginning of the else if clause?
3) Since you already have a method to change the state ChangeState() , what exactly is the purpose of operation1() method?

Also, try using the "preview" button when posting so you can see if your code tags are correct.;)

DdoubleD 315 Posting Shark

I was just trying to make my client's dream become true.
But i handled it in a different way.Thanks DoubleD.:)

Do you mind if I ask the situation and how you handled it?

DdoubleD 315 Posting Shark

Here is another way to do it:

Image img = Image.FromFile(fileName);
            Bitmap bmpInverted = new Bitmap(img.Width, img.Height);
            ImageAttributes ia = new ImageAttributes();
            ColorMatrix cmPicture = new ColorMatrix(new float[][]
            {
                new float[] {-1, 0, 0, 0, 0},
                new float[] {0, -1, 0, 0, 0},
                new float[] {0, 0, -1, 0, 0},
                new float[] {0, 0, 0, 1, 0},
                new float[] {1, 1, 1, 0, 1}
            });
            ia.SetColorMatrix(cmPicture);//cm);
            Graphics g = Graphics.FromImage(bmpInverted);
            g.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, ia);
            g.Dispose();
            img.Dispose();

            // use the bmpInverted object, which contains the inverted bitmap
            pictureBox1.Image = bmpInverted;

I don't know how the speed compares to sknake's example, but he probably would know.;)

sknake commented: another good way to go about it +14
DdoubleD 315 Posting Shark

Is step1 in adding parameter to the crystal report is:-
in .rpt file :-field explorer -->parameter field-->new ?.
I mean is that a mandatory step?.

I don't know whether you can programattically add new parameter fields to a report without running into undefined/bad behavior. My question is, why would you want to add parameter fields dynamically? How can the report itself benefit from a field that otherwise is not referenced by the report?

And don't worry about "stupid questions"--I ask them all the time..;)

DdoubleD 315 Posting Shark

Oh drats! I downloaded a pocketpc project and tried to run it deployed to my device, but VS and I discovered ActiveSync is no longer installed on this machine, though I still have a shortcut for it. I thought about reinstalling it, then I remembered what I had to go through last time with upgrading the device's OS, and that was an old service release back then too I think.

So, I guess I should purchase a more current OS than version 4.20.1081? I don't want to go through all this trouble to learn my OS is too old to be practical.

I did find the emulator deployment to be very slick. At first I thought it was really buggy because of the way it was acting, but then my screen blanked and freaked me out. It soon gave me that message about loading the .net source reference cache that I have enabled for debugging, which took a while since it had to find and download it from the web. So I guess the program was still loading while the emulator was letting me do PocketPC like functions--weird stuff.

Anyway, it doesn't look like I will be of much help to you anytime soon. I did notice a project/article of interest on codeproject, written in c++ by a researcher at MS back in 2004, that you might want to take a look at if you haven't already: Manual uninstaller for PocketPC

DdoubleD 315 Posting Shark

What is the Specified argument was out of the range of valid values?.I don't get it.

The argument out of range exception is saying you are attempting to access an element outside of the allocated array size:

ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME];------  here i get the exeption

The definition PARAMETER_FIELD_NAME is a value that is larger/outside than the parameterFields.Count() - 1 element, which is the last possible element available.

DdoubleD 315 Posting Shark

:yawn:I'm so tired... I need some sknake oil I thinks....

I will try again this weekend. Surely someone will know the answer to your question by then...;)

DdoubleD 315 Posting Shark

:( Oh, figure it out myself from the beginning...I get it...:cool: OK. Just thought I would try to help by involving myself in such a project, and I did just hook up my pda and reboot and all. I'll watch the thread to see what they tell you...:P

Cheers!

I guess there was a time delay or something because I didn't see the other posts... ;)

Anyway, I am looking into it, but I hope someone else will give a response before I can.

Cheers!

DdoubleD 315 Posting Shark

the starter project could be this. pick some easy .net questions from c# forum, then create a mobile application using visual studio and do the code sample on mobile project. then post the code along with mobile attachment :) and also you can submit the same project in windows forms application version. try to convert windows forms applications to mobile applications. that will teach you a lot. that is what i am doing all day long professionally.

:( Oh, figure it out myself from the beginning...I get it...:cool: OK. Just thought I would try to help by involving myself in such a project, and I did just hook up my pda and reboot and all. I'll watch the thread to see what they tell you...:P

Cheers!

DdoubleD 315 Posting Shark

Nope, but I'm feeling frisky... What/where would be a good starter project like "hello world", because I own a couple of PocketPC's and have never tried to interface but would like to learn?;) If you could make that a project suggestion that then updates with ActiveSync, I would of course pursue finding an answer to your question as well, I noticed thread because I used to ActiveSync with my PocketPC years ago, but never tried to interface programmatically. I searched around, given what I know, but I didn't think anything I found directly addressed your problem.

OK, I'm diggin out my pocket pc and connections and getting ready to shutdown so I can find room in my power strip...don't blow me off--;)

DdoubleD 315 Posting Shark

when it comes to mobile development, you guys have no idea, do you?

Nope, but I'm feeling frisky... What/where would be a good starter project like "hello world", because I own a couple of PocketPC's and have never tried to interface but would like to learn?;) If you could make that a project suggestion that then updates with ActiveSync, I would of course pursue finding an answer to your question as well, I noticed thread because I used to ActiveSync with my PocketPC years ago, but never tried to interface programmatically. I searched around, given what I know, but I didn't think anything I found directly addressed your problem.

DdoubleD 315 Posting Shark

Not to intrude because I happened upon this and I'm really not a page designer, but I would recommend:
* Lose the black font on the dark blue background because it took my eyes a while to adjust (weather area)
* lighten/brighten the "fam pic.jpg" to be consistent because the face sitting topmost is about the brightness I think you want to achieve across all of the image

DdoubleD 315 Posting Shark

where Scott finds this energy from is the matter of question now.

I know what you mean... Everytime I walk into Circle-K or 7-Eleven, I look at the counter and expect to find an "Energy drink powered by SKNAKE"--:D

DdoubleD 315 Posting Shark

Sure, if that is what you really want to do:

public Form2(Control [] controls) {}
//or
    public Form2(Button btn1, Button btn2, Button btn3)// etc.
    {}

or, you could even pass in reference to other form if the called form will know the controls and they are accessible:

public Form2(Form form1) {}
Diamonddrake commented: That's how I would have done it! +3
ddanbe commented: Passing a Form to a Form, nice! +12
DdoubleD 315 Posting Shark

Sure, if that is what you really want to do:

public Form2(Control [] controls) {}
//or
    public Form2(Button btn1, Button btn2, Button btn3)// etc.
    {}
DdoubleD 315 Posting Shark

when you need a messagebox, you just call a static method to show it. ex.

System.Windows.Forms.MessageBox.Show("some message");

I know this is solved, but I just wanted to add that I often use static methods to test out a class I have written: eg. public static void Test() , then as DiamondDrake has pointed out with the example usage of MesageBox.Show() , you let the method, Test() in my case, take care of the details related to the class including instantiating it.

Cheers!

DdoubleD 315 Posting Shark

See.. i dnt need the path of my C# application.... i need the full path of the other running processess... suppose if i opened a text file or a word file then since my C# application is working in background , this pgm must get the path of the opened text file...

It occurred to me, because this thread has not been marked SOLVED, you might be trying to figure out what process has a file open: investigating who has my file locked

DdoubleD 315 Posting Shark

There are hospital management systems available to browse online, some including source code of a complete system and design. You may wish to check out those designs too when beginning your design.

DdoubleD 315 Posting Shark

This is the code.. They are definitely not out of scope.

private void button1_Click(object sender, EventArgs e)
        {
            int a,b;
            a =  int.Parse(textBox1.Text);
            b = int.Parse(textBox2.Text);
            int c = a + b;
            textBox3.Text = c.ToString();
                     
        }// breakpoint

So, you have a breakpoint such as commented above on the closing brace, but still cannot see the vars values when hovering?

DdoubleD 315 Posting Shark

Is the variable in scope that you are trying to view? Also, if the code is optimized it may not show.

DdoubleD 315 Posting Shark

I would ++rep you if Daniweb would allow it. I didn't realise it split up 64 bit applications. I live in a 32bit world :(

Yea, I'm 32 bit too, but I did notice that Serkan is running Vista in another thread, so maybe it will help. Cheers!

DdoubleD 315 Posting Shark

the thing i nee to do is when the firs click of a button the panel must be visible.
the next click of the same button must hide the panel,
again 3rd click must show the panel,
4th hide 5th show..
.....etc like that,,,

So this thread is solved then?

Because you have already been given the code to do that:

private void button1_Click(object sender, EventArgs e)
        {
          panel1.Visible = !panel1.Visible;
        }

The code above omits the process loop you had originally, but it appears you only want to toggle the Visible property of the panel. If the panel must be visible before first click, you need only set it that way in your form's load, where you currently have it set to false:

private void Form1_Load(object sender, EventArgs e)
        {
           // panel1 p1 = new Panel();
           panel1.Visible = true; // instead of false
        }

I've asked whether you also wanted to do something with the process loop, but you either don't need to do anything with it or you forgot to answer that question.

DdoubleD 315 Posting Shark

It is unclear to me what it is you are trying to achieve with this program. Yes, taking the setting of the panel1.Visible property out of the loop inside the button click will stop the flickering.

Why are you iterating through the processes anyway? You don't do anything with the information.

DdoubleD 315 Posting Shark

Thanks Scott, but it seems that it doesnt show all the programs that are installed. I think registry information is not enough or we need to grab some more information from other folders under registry.

Ideas?

This may or may not apply in your case, and you may wish to browse your registry to see first. Anyway, I ran into this additional key while browsing this topic and figured I would pass it on:

The (code) appeared to only get about half of the applications that I have installed on my Vista Ultimate 64-bit development box. After some poking around the registry, I discovered that the half that it got were all the 64-bit applications and that the 32-bit applications were hiding under SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall.

DdoubleD 315 Posting Shark

Sorry, I thought you were interested also in calling the wizard with that option. Information to build that list from the registry is easily obtained on the web, but I could not find any C# API to execute any commands.

Cheers!

DdoubleD 315 Posting Shark

please give me some c# code sample even pseudocode.

Those are options for launching a separate appwiz process with the selected option. To launch the process:

Process appwiz = new Process();

            appwiz.StartInfo.FileName = "control";
            appwiz.StartInfo.Arguments = "appwiz.cpl,,0";// change or remove program option

            appwiz.Start();
serkan sendur commented: chic +8
DdoubleD 315 Posting Shark

Cmd options:
control appwiz.cpl,,0 // change or remove programs
control appwiz.cpl,,1 // add new programs
control appwiz.cpl,,2 // add remove windows components
control appwiz.cpl,,3 // set program access and defailts

DdoubleD 315 Posting Shark

Attach your project so we can what you are doing.

DdoubleD 315 Posting Shark

why do you need a count? Is that part of a homework requirement to maintain a count?

DdoubleD 315 Posting Shark
panel1.Visible = panel1.Visible ? false : true; // toggle the on/off state of the Visible property
DdoubleD 315 Posting Shark

This thread seems to have been answered in another thread: http://www.daniweb.com/forums/thread31105.html

sknake commented: Thanks! +13
DdoubleD 315 Posting Shark
private void SetCurrentValuesForParameterField(ParameterFields parameterFields)
        {
            ParameterValues currentParameterValues = new ParameterValues();
            foreach (string str in td.Values)
            {
                ParameterDiscreteValue parameterDiscreteValue = new ParameterDiscreteValue();
                parameterDiscreteValue.Value = str;
                currentParameterValues.Add(parameterDiscreteValue);
            }
         ParameterField parameterField = parameterFields[PARAMETER_FIELD_NAME];------  here i get the exeption
            parameterField.CurrentValues = currentParameterValues;
        }

the code to bind reportviewer control:-

ParameterFields parameterFields = crystalReportViewer1.ParameterFieldInfo;
            SetCurrentValuesForParameterField(parameterFields);

Hi Wafaa. I looks like you added the param value, but did not add the new parameter to the field collection. See this MSDN example:

private ParameterFields AddParameter 
   (string paramName, string paramValue,
   ParameterFields paramFields)
{
   ParameterField paramField= new ParameterField ();
   ParameterDiscreteValue paramDiscreteValue = new 
   ParameterDiscreteValue ();
   ParameterValues paramValues = new ParameterValues ();

   // Set the name of the parameter to modify.
   paramField.ParameterFieldName = paramName;

   // Set a value to the parameter.
   paramDiscreteValue.Value = paramValue;
   paramValues.Add (paramDiscreteValue);
   paramField.CurrentValues = paramValues;

   // Add the parameter to the ParameterFields collection.
   paramFields.Add (paramField);
   return paramFields;
}
DdoubleD 315 Posting Shark

2.]I have multiple forms that is "linked". linked in a way that the value of a textbox In the first form will be used in the next form.there are 'next' and 'back' button in every form.when I entered for example "daniweb" in one of my Txtbox,click next,then click back again,the word I entered in that txtbox is gone.actually all the controls is being "reset".
this is the code i used to switch forms

Why not use a TabControl and allow the user to traverse back and forth (Back / Next) through each of the pages on a single form?

DdoubleD 315 Posting Shark

That code will not compile

I posted the original code and pointed out the problem area within the function as I saw it. I also use treat warnings as errors. I didn't try to compile the function because I didn't need too.

Cheers!

DdoubleD 315 Posting Shark

The fields are DefectType, RootType in the Page Header C section and also the details section complete thanks

[ATTACH]11524[/ATTACH]

When I opened this report, I got some sort of wizard or installer telling me it was created in a new version of Crystal. Anyway, I'm not very familiar with this Crystal built into the VS IDE and it's been years since I've viewed a report in the Crystal Designer, which was a separate product then, but I noticed something when using the Select Expert on the DefectType field. The selection formula reads:

{tbl_Main_NCR.NCR_NUMBER} = {?NcrNumber}

but, shouldn't it somehow show a tie to the DEFECT_CODE for that record? I don't know proper formula syntax, but I hope I will convey what I mean in this snippet:

{tbl_Main_NCR.NCR_NUMBER} = {?NcrNumber} && {tbl_Main_NCR.DEFECT_CODE} = {EW_DEFECT_CODE.DefectCode}

Sorry if I'm way off base here. I tried to find some visual linking expert so I could visual examine the linked tables to verify that there was indeed a link on the DefectCode, but couldn't find that option in my IDE.

DdoubleD 315 Posting Shark
DdoubleD 315 Posting Shark
DdoubleD 315 Posting Shark

Can you be more specific with, "I don't know what it means?"

Are you talking about compiler errors you are getting?:?:

DdoubleD 315 Posting Shark

That's supposed be the shape of a diamond:

X
X X
X O X
X O O X
X O O O X
X O O O O X
X O O O O O X
X O O O O O O X
X O O O O O O O X
X O O O O O O O O X
X O O O O O O O O O X
X O O O O O O O O O O X
X O O O O O O O O O X
X O O O O O O O O X
X O O O O O O O X
X O O O O O O X
X O O O O O X
X O O O O X
X O O O X
X O O X
X O X
X X
X

Here are changes to your Draw() function that will get you your fill character--I set it to "O" like your pattern. You still need some code to push the pattern out to form a diamond (opposite triangle) on the left. but you are close. I did not notice until now that the pattern you provided was striped of spaces on the left.

Look at the gaps in the lines output too--your program is skipping every …