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

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

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

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

There are many example projects of file compression in CPP: CPP and File Compression

DdoubleD 315 Posting Shark

Look at Array.IndexOf and Array.LastIndexOf , which will give you the index of the first and last occurrence of the int in your array.

DdoubleD 315 Posting Shark
int playerNum;
char playerSymbol;

// decide whose turn it is.
if (playerNum == 1)
    playerSymbol = 'X';
else
    playerSymbol = 'Y';

cout<<"\nPlayer " << playerNum << " make your move. Choose locations 1 to 9 \n";
cin>>input;
switch (input)
{
    // same switch code, but don't hard-code 'X' or 'Y'.  Replace 'X' and 'Y' in code with playerSymbol.
}

Modified to show how you can stop using goto statements:

bool ValidateMove (int location, char playerSymbol)
{
	switch (location)
	{
		// same switch code, but don't hard-code 'X' or 'Y'.  Replace 'X' and 'Y' in code with playerSymbol.

		// return false if invalid move and such, or true if valid
	}
}

void TicTacToe (void)
{

	int playerNum;
	char playerSymbol;
	bool done = false;
	int input;

	do
	{
		// decide whose turn it is.
		if (playerNum == 1)
			playerSymbol = 'X';
		else
			playerSymbol = 'Y';

		cout<<"\nPlayer " << playerNum << " make your move. Choose locations 1 to 9 \n";
		cin>>input;

		// TODO: use input to get sentinel to determine to exit

		// if valid, change players...otherwise, just loop and ask location again...
		if (ValidateMove(intput, playerSymbol))
		{
			// setup for next player
			if (1 == playerNum)
				playerNum = 2;
			else
				playerNum = 1;

			continue;
		}

		// TODO: if game is over, set done = true or just break

	} while (!done);
}
DdoubleD 315 Posting Shark

OK, found something obvious: You have defined "linkedList" name for definition (in .cpp), but "LinkedList" name for declaration (in .h). Fix that and see what you get...

Also, you left off the "bool" keyword in definition of isEmpty in .cpp. Change to: template <class Storeable> bool LinkedList<Storeable>::isEmpty()

DdoubleD 315 Posting Shark

so i should replace "Storeable" with "Type" ? My teacher didn't say much about templates, i was under the impression that you can put whatever word you wanted like a variable. The book im looking at uses "Type" so thats where i got that from.

am i missing something else painfully obvious?

No, disregard my previous, but brief rant--LOL. These types of errors can be so elusive... I haven't seen the "obvious" here either yet.

DdoubleD 315 Posting Shark

What is the definition of Storeable? You declare types, but I don't see the definition.

DdoubleD 315 Posting Shark

You forgot to include the contents of: "nodeType.h"

kyosuke0 commented: very helpful +1
DdoubleD 315 Posting Shark

Hy, I want to create several mdb files. Done that,I've created several tables, populated them, but I want to protect them by a custom password. How can I do that? :icon_confused:
Thanks!

Not sure if this is a C# question, but if you open your MDB and goto Tools > Security > Set database Password, you can put a password protection on it.

NOTE: Password protection on the Access file alone is not enough unless you are just preventing accidental viewing of the database. Search the web on this topic and you will see why...

DdoubleD 315 Posting Shark

Please use code tags--it is very difficult to look at code that is not formatted.

You posted your code, but you haven't indicated a problem. Is there a particular problem you are noticing (compiling or at runtime)?

You should also attach your input data file so when someone wants to help you they can have everything they need to get started.

Cheers!

DdoubleD 315 Posting Shark

goto? really? Why not put the switch code into a function bool ValidInput(...) and then loop for each user's input until it is valid?

while (!ValidInput(...))
{
    cout<<"...make your move...";
    cin>>input;
}

You could then reuse one set of the switch code for each user input call. Though it is possible to do this with goto statements as well, I won't help you with that--very nasty stuff!:P

DdoubleD 315 Posting Shark

Ok, so this was a bit more simple than I thought... Here's the method I created to display the control's event info

private void LogIt(object sender)
{
checkedList.Items.Add((string)sender.ToString());
}

Then after the click event of every control I simply put LogIt(sender) and it sends the info into the listbox.
My new problem is that the checked list box is on a different form called 'frmEventInfo.' I have a button on the main form that displays frmEventInfo. I want to keep the LogIt method and have all of the events that it has saved sent onto the listbox on frmEventInfo. How can I do that?

Here is an example that you can see how to make your method a delegate passed to another form. Copy this code into a source file's class and just call the YourClassName.TestDelegate() method while stepping through the code and you will see what is happening:

public delegate void Delegate_LogIt(object sender);

        public class MyMainForm
        {
            private void LogIt(object sender)
            {
                // commenting out your code line so this will compile
                //checkedList.Items.Add((string)sender.ToString());
                Console.WriteLine(sender.ToString());
            }
            public void Run()
            {
                RunBogusForm2();
            }

            public void RunBogusForm2()
            {
                // pass in method LogIt to new form as delegate
                MyCalledForm bogusForm = new MyCalledForm(LogIt);
                int justAnObject = 3000;
                bogusForm.RaiseFakeEvent(justAnObject);
            }
        }
        public class MyCalledForm
        {
            public Delegate_LogIt delegate_LogIt;
            public MyCalledForm(Delegate_LogIt delegate_LogIt)
            {
                this.delegate_LogIt = delegate_LogIt;
            }

            // mimicking an event
            public void RaiseFakeEvent(object sender)
            {
                delegate_LogIt(sender); // will call your LogIt(sender) method
            }
        }
        public static void TestDelegate()
        {
            MyMainForm bogusForm = …
DdoubleD 315 Posting Shark

actually iam using .net 2008 is it the same as 2005?

I think there is a link on that page for 2008 version: Deployment with VS 2008

DdoubleD 315 Posting Shark

You probably need to commit your changes. See AcceptChanges() method.

DdoubleD 315 Posting Shark

I'm not sure why Serkan's example was not sufficient, but here is another demonstration. You would need to complete the case labels with the remaining conditional requirements.

public static void Test()
        {
            int [] A = {6090, 6100, 6200};
            bool b = CompareAB(A, 995);
            b = CompareAB(A, 1005);
        }
        public static bool CompareAB(int[] A, int B)
        {
            switch (B)
            {
                case 995:
                case 1005:
                case 1010:
                    if (A.Contains(6090) && (A.Contains(6100) || A.Contains(6110)))
                        return true;
                    break;
                case 1015:
                case 1020:
                case 1030:
                    break;
            }

            return false;
        }
DdoubleD 315 Posting Shark

Hi. Did you figure this problem out yet? I could simply give you a short and precise answer to your question--Yes (LOL), but you probably want to know what the reason is too, right?

Can you attach the report file and list what the "3 specific values" are?

DdoubleD 315 Posting Shark

2. Can any one explain how to make a form modal when the showDialog is called from a timer instead of the parent form thread?

If your thread has access to the parent form's handle, I think you can pass that into the ShowDialog(IWin32Window owner) to get that behavior.

DdoubleD 315 Posting Shark

1. Can any one explain the inner workings of the form.enabled property so that I can have it use a list to traverse through the hierarchy of its own controls it has to enable? I have read that if enabled uses a list, it is faster; but I have no idea how to actually implement this idea.

You can iterate through all of the form's controls when the Form's enabled property is changed in the EnabledChanged event:

private void Form1_EnabledChanged(object sender, EventArgs e)
        {
            bool bEnabled = this.Enabled;
            foreach (Control ctrl in this.Controls)
            {
                ctrl.Enabled = bEnabled;
            }
        }
DdoubleD 315 Posting Shark

I guess the problem is c# creates the textboxes after runs my naming code. If there way to get the names directly from the database? Or another way for doing this?

Just an FYI because it's not a solution to your problem. Unless you have manually implemented the creation of your controls, they are created in the form's constructor via a call to InitializeComponents() . So, assuming that this is how your controls are created, then they have already been created because your form's Load() method gets called after the form is created, but before it shown/active.

Here is an excerpt from MS about the designer generated method:

InitializeComponent is a designer-managed area of your form code to which the designer serializes relevant initialization code for the controls and components hosted on the form. The designer uses InitializeComponent to remember control state across form loads at design time and to initialize controls for run-time execution

DdoubleD 315 Posting Shark

@Gribouillis, @DdoubleD:
From load into memory can I assume you mean two giant multidimensional arrays? Thinking about it....I wouldn't have to keep reloading the data and only commit when I've worked it out. Thanks!

Wish I knew Python because I'd love to help you out with this. I definitely think that working with the record sets in memory is the way to go though if you can pull it off; then do your final update(s) to DB. Best of luck!

DdoubleD 315 Posting Shark

But to answer your question you can use RegEx:

private void button15_Click(object sender, EventArgs e)
    {
      const string sentence = @"This is Daniweb Forums.Good Luck";
      string[] regex = System.Text.RegularExpressions.Regex.Split(sentence, @"\W");
      System.Diagnostics.Debugger.Break();
    }

You lost me.... I tested it and the "\\W" works fine, but what is it?

DdoubleD 315 Posting Shark

You could also consider loading all the schools and children in memory and modify the database only when you know in which school each child goes (this can be done if you're able to compute the distance between a child and a school without the ST_DISTANCE function).
Also, try to use the cProfile module to tell you where time is spent.

In my opinion, the only correct way to do this is to load the records in memory and process them rather than this UPDATE and SELECT through each iteration of your two loops!

DdoubleD 315 Posting Shark

I noticed this link posted by adatapost, which seems to use the dashed outline on the drag you are looking to replicate, but cannot be sure because I did not get to see your IMG tag. Anyway, it's a TreeView drag/drop I believe, but the owner drawn stuff is probably the same with some minor tweaks: http://www.codeproject.com/KB/tree/mwcontrols.aspx?msg=904987

Cheers!

serkan sendur commented: chic +7
DdoubleD 315 Posting Shark

:P LOL. That's a lot of PP, so if that was supposed to be a joke you got me.

DdoubleD 315 Posting Shark

I have the following code and it wont compile, it says no matching function for call to `autop::autop(autop)' at this part

autop j = f();

I got no compiler error with that code.

Another Thing:

when used inside the function parameter list (i.e autop(autop & s) , whats the effect of the &, does it creates a ref, or is it passing an address, is it the same( I dont see how) , how should I understand it.

I also wonder why using & to get the address of anything adds a '*' i.e if I have

int * p 
int x;
p = x //wont work AND compiler says: invalid conversion from int to int* 
//same applies to 
int ** pp;
int * p
pp = p;

so question why adding an & makes the '*' match to the compiler
Does taking the address of anything gives me a pointer or what
:confused:

Because Pointers point to References, you need to resolve a variable to its reference when assigning to a pointer. Therefore, to say that int *p = &x is to say "p" points to reference "x". When you try int *p = x , you are attempting to say an address pointer points to an integer value, which is why you get an error because this code is suspect of being in error.

Part 2: Your **pp is a pointer to a pointer, so when you dereference "**pp" as *pp, it must be a …

DdoubleD 315 Posting Shark
if ((count % 2) == 1)

oops! I posted this before realizing it was Java...Sorry in advance if the syntax is wrong.

DdoubleD 315 Posting Shark

You are losing the precision in your division. You need to cast:

div = (float)num1 / (float)num2;

Your printf requires "%%" to represent a literal % symbol:

printf("> %d %% %d = %d.\n", num1, num2, mod);

Can't help you with the search parameter for "C", but I'll be watching to see what others say.

Cheers!

DdoubleD 315 Posting Shark

Also, you could modify your print loops to accomplish the logical pattern. What is the requirement?

DdoubleD 315 Posting Shark

Please use code tags.

In your matrix function, you are assigning -1 to all elements. If you want to assign the pattern of numbers you specified you would like to output, then you need to assign them as such.

Having said that, do you want to put them into your matrix completely hard coded? Probably not, but I don't know. If not, you need to modify your loops to contain logic that will assign your matrix according to the pattern. If so, then it's an easier thing to achieve because you don't need any logic.

Syntax for hard-coded array:

int table[r][c] = {{-1,-1,-1,-1,-1, 0},
					{-1,-1,-1,-1,0,1},
					{-1,-1,-1,0,1,1},
					{-1,-1,0,1,1,1},
					{-1,0,1,1,1,1},
					{0,1,1,1,1,1}};
DdoubleD 315 Posting Shark

No problem. If that answered you questions, please mark as solved.

Cheers!

DdoubleD 315 Posting Shark

If you specify a default contsructor for you Item struct definition, this error will go away:

Item(void) :name(""), iid(0), value(0.0) {}
DdoubleD 315 Posting Shark

If you know your string contains only words separated by spaces you could use:

string Mystr = "This is a sentence.";
string[] split = Mystr.Split(new Char[] {' '});

Now split[1] would contain the word "is".

Ah, yes! then just iterate through the array and count only those have Length > 0 --nice!

DdoubleD 315 Posting Shark

Well, you probably want to remove any leading or trailing spaces so you don't count extra words--see string.Trim() . Then, you could loop through the string looking for " " (space) and count each one you find using string.IndexOf() or IndexOfAny() , but you probably want another loop inside of that to skip extra spaces so you only count one word for mulitple contiguous spaces e.g. " " (two spaces together).

DdoubleD 315 Posting Shark

And, if you pass in your listView1 object in the constructor:

ListView.ListViewItemCollection lvic = new ListView.ListViewItemCollection(listView1);

it appears to return a reference to the listView1's item collection.

Again, I recommend looking into ddanbe's suggestion using the SelectedListViewItemsCollection .

DdoubleD 315 Posting Shark

Have you a SelectedListViewItemsCollection class, or is it missing in a compact framework?

I think what ddanbe has led you to is what you want/need. However, I was a little confused when you said there is no constructor and you couldn't create an instance, so I had to check this myself and I found I could do it, though I cannot imagine wanting to:

ListView.ListViewItemCollection lvic = new ListView.ListViewItemCollection(new ListView());

Cheers!

DdoubleD 315 Posting Shark

actually i tried to make the program in the link you showed me to run but i couldn't but i tried to pass parameters to the crystal report and export it to word using export in it's options in the report viewer not using my code it exported the report with the parameters in it so it makes me don't need to append in the word document thanks double d you helped me alot and it's so appreciated

but there is another problem when the crystal report is exported to the word document the it exports the arabic daynamic data in it reversed do you know how to handle that

You are most welcome!

I don't know why you are getting the data reversed. May I suggest you close this thread and start a new one about the reversal of the data?

Cheers!

DdoubleD 315 Posting Shark

More elaboration...

if (comparevalue.Days < 3)
                {

                    foreach (string s in files)
                    {
                        fileName = System.IO.Path.GetFileName(s);
                        destFile = System.IO.Path.Combine(targetdir, fileName);
                        System.IO.File.Copy(s, destFile, true);
                        sw.WriteLine("Log " + s + " has been copied..");
                    }
                }

This inner loop is copying all of the files regardless of whether they met your date check as long as only one them does meet the date check because your inner and outer loops are looping through the same list--right?

DdoubleD 315 Posting Shark

Maybe I have read this code wrong, but it looks to me like you are looping and copying all of the files if one of them matches (> 3 days), and that you are doing it each time one of them matches, essentially redundant. Did you mean for both of these to build from the same folder?

// get files from expandedsystemroot
            string[] files = System.IO.Directory.GetFiles(ExpandedSystemRoot, "*.flog");
            DirectoryInfo dirinfo = new DirectoryInfo(ExpandedSystemRoot);
            // get files from expandedsystemroot
            System.IO.FileInfo[] fileinfo = dirinfo.GetFiles("*.flog");
DdoubleD 315 Posting Shark

Are you using subreports in the report?