camilojvarona 0 Junior Poster in Training

Paste this before the save code and try modifying the first row in the DataGridView(I am assuming that you have two or more rows),

int selectIndex = this.listBox1.SelectedIndex;
            this.listBox1.SelectedIndex = 1;
            this.listBox1.SelectedIndex = selectIndex;

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Try refreshing the DataGridView control programmatically(DataGridView.Refresh()) right after inserting the new row and if it doesn't then copy and paste the code as appear in you application in a new post.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

In this code

DataRow[] drAdded = dtRemarks.Select("", "", DataViewRowState.Added);
DataRow[] drModified = dtRemarks.Select("", "", DataViewRowState.ModifiedCurrent);

I think that the problem is that each row has a property RowState and the DataTable.Select method compare the paramter that you passed against the value of this property and can only be either DataViewRowState.Added or DataViewState.ModifiedCurrent for a single row.


Also you can go to this link

http://msdn.microsoft.com/en-us/library/thc1eetk(VS.80).aspx

that it shows another way of retrieving the changed rows in a DataTable.

And in this link you can see how the RowState change with each operation.

http://msdn.microsoft.com/en-us/library/system.data.datarow.rowstate(VS.80).aspx


Regards,
Camilo.

camilojvarona 0 Junior Poster in Training

Hi,

A littler late but this is all you need to do.

dataTable.Rows.RemoveAt(this.listBox.SelectedIndex);

of course like a said in one of the above posts this will update any other Control that is bound to that DataTable if any.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

If you had used the DataSource property it should not let you modified the ListBox. Can you post some code.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

.

Just because it works with your compiler does not mean it will work with others. The initial values of an array are undefined in C++, which means they may be 0 or anything else.

To initialize an array whose size is not know at compile time, you have to dynamically allocate space, which in C++ usually means using the new operator. You shouldn't use the std::nothrow parameter unless you understand what it does: if the requested memory cannot be allocated, no exception is thrown and NULL is returned.

See niek_e's post for a proper example of dynamically allocating an array.

Hi,

Just because a named it 'arrays' doest mean that it is not a pointer ;-). Also a read the material on this site http://www.cplusplus.com and I now why to use 'nothrow'.

In this articles said that wen you create an array (e.i int array[value]) It actually reserved that space in the memory. So there is no needs for inticialitation. I assume the same behavior with dynamic memory for an example that is in that site to.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

The reason is that every time you drag and drop a control into the designer. What happends under the hood is that a private property is created(say private MenuStrip menuString1 ). just change the access modifier to public. Althoug for what I understand that you are trying to do this solution is better go to this thread and look at the post #8.

http://www.daniweb.com/forums/thread133729.html

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi niek_e,

Yeap, I've changed it. Thanks for your coments. Although I used your idea but without the 'initialize all elemets to zero' part and works fine. Now I am reading a manual and saw this way arrays = new (nothrow)int['variable'] Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I was trying a thing but it didn't work. When will I learn tha array's size most be constant an compile-time :-).

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I don't know if this is the best way to do it but my idea is to create a class for mapping the results that you get from the database and since the ListTextBox.Items.Add takes an object as parameter then you can pass an instance of that class that you had created.

Hope this help.
Camilo

camilojvarona 0 Junior Poster in Training

Hi Narue,

Thanks for your sugestions. Actually this is my first day at C++.

"So should you. If you want to talk about how things should be done, just go ahead and do them instead "

In case you haven't noticed almost every tutorial for beginers as I am and as I asume the one who posted the answer they do it the way I did it for the sake of clarity.

"Giving away homework answers is still frowned upon here. "

Sorry about that. You should think that I did it on porposed bu I didn't.I haven't see your post. Still is a functional code as you see has a lot of flags so everybody learn. Today I've wrote my first line with C++ :-).

" but all of them are pointless in this case as this doesn't make the code any clearer"

Here I disagreed with you this since you would remove a couple of lines of code and every line of code that you add increases the risks of erros , and makes the code less readeble and increases the maintenance effort, and de costs of the project.


Again thanks for your sugestions.

Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Hire is the code.

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <string>

using namespace std;

  
  
  
  int main()
  {

      
      int arrayLength = 0;
      cout << "Enter the numbers of elements of the array: ";
      cin >> arrayLength;
      int array[arrayLength];
      int index = 0;
      int lowest ;//Here you could assing the 'int' highest value even though I've read that depends on sytem the prorgram is compiled 32-bits... But maybe there is a funtion that give you the value at run time. Or simple depending on the system.(I'm new to C++)
      int highest ;//Here you could assing the 'int' lowest value.
      
      //Capturing the entries and getting the lowest and highest values.
      do
      {
              cout << "Enter value number " << index << " :" ;
              cin >> array[index];//Here you should use get_line()
              cout << endl;
              //Remove this if statement if you initialize the value as mentioned above.
              if(index == 0)
              {
                 cout << "index == 0";
                 lowest = array[0];
                 highest = array[0];         
              }
              if(lowest > array[index])
                  lowest = array[index];
              if(highest < array[index])
                 highest = array[index];
                 index++;
      }
      while(index < arrayLength);
          
      cout <<  "The highest value is: " << highest << " And the lowest is: " << lowest << endl;
     
     system("PAUSE");
     
  return 0;
  }

you should do defensive programming if you want to improve it.


Any sugestiong on how to improve this code will be highly appritiated. I am new to C++;

Hope this help.
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Cange this line of code:

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[$a]."'" );

for this one

$result = mysql_query("SELECT * FROM  autoalto_mail where mail_id='".$_REQUEST[mail_id]."'" );

Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Ok we are moving forward. Now remove the 'where' clause.

Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Try this to see if you are getting any rows.

echo mysql_num_rows($result) ;

you can also do $row[0] that way you wouldn't have to worry about the spelling.


Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Make sure that your From has the same namespace as the class from where you want to cosume it.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Try this

int id = 2;
            string idStr;
            idStr = id.ToString().PadLeft(4,'0');

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

"Microsoft supports thi datasource for us, why dont we use it? Could you explain to me?"

I think that the logic is like fallows. When you bind a DataTable to a ListBox what you get is a reference to the DataTable if you change any value in the ListBox you would be actually afecting any other object that is also bindded to that DataTable. So in my opinion that might be the motive. Also in OOP I don't think that is 'good practice' to change tha value of an object indirectly. (e.i Changing the value of the ListBox you are inded changing the value of the DataSet).

Hope this help,
Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

What program are you using for debugin your application?. I am using PHP Designer. I think that it would be useful to see what warnings does it give you.

Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I am as newbie to PHP as you but in this line you missed teh '$' symbol.

sql="SELECT login,id FROM tblDealer WHERE login='".$email."' and password='".$password."'";

in front of the sql variable

$sql

Although you can go to this link

http://us2.php.net/manual/en/function.mysql-query.php

Hope this help,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Seems to me that you need to change the AttachDbFilename=D:\WindowsApplication1\Database1.mdf; to the path where is the database on the server.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Check out this video that shows how to paging using LINQ to SQL

http://www.scottgu.com/blogposts/video/linqtalk1.wmv

Regards,
Camilo

camilojvarona 0 Junior Poster in Training
camilojvarona 0 Junior Poster in Training

Hi,

The anwer is in your post. Simply don't use binding.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I'v found this link. If is not exactly what you are looking for al least should point you in the right direction.

http://blogs.x2line.com/al/archive/2005/11/18/1323.aspx

P.S I've been playing around with it and works great!. This is definitly what I would use.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Write is with capital letter like Console.Write("Hello"); . Remember that C# is case-sensitive.


Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

For connecting with the backend database you need ADO.NET, although you can use LINQ tp SQL to. It's your call. An you can add values dinamically to the ComboBox like this

this.comboBox1.Items.Add("Item");

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

This is how to delete it from the CheckBoxList :

private void buttonDeleteItem_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < this.checkedListBox1.CheckedItems.Count; i++ )
     { 
       this.checkedListBox1.Items.Remove(this.checkedListBox1.CheckedItems[i]);

      string modified = theStringFromWhereYouLoadTheTextBox.Replace(this.checkedListBox.CheckedItems[i].ToString(), string.Empty );//And then Create a new file with same name that the original from modified
               
       }
  }

the replace part depends on how your text file is formatted.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,


I assume that when you say "getting the docuement formatted differently is not an option" you mean that you don't want to change the original document. So here is my idea

1.Get the XML document as a 'string' with StreamReader.ReadToEnd .

2.Create a method than inserts the quotes and return the result as a 'string'.

3.Use the XmlReader against the 'string' returned by the method (2) like this XmlReader xmlR = new XmlTextReader(the method here); .

Hope this help,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I don't quite get your quetion. Can you post some code?.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I have found this link

http://www.codeproject.com/KB/database/sqldodont.aspx

You should find articles about multithreading and Background Worker.

>I want to just send data in blocks to dataset

I think that you may use paging and this way retrieve your rows on demand.

Hope this help,
Regards
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Find anything about OpenFileDialog, SaveFileDialog, RichtTextBox controls.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Wha you missed was 'a in', here is the correct way.

XDocument test = XDocument.Load(dataPath + "c:\\test.xml");
            var result =  new XElement("a", from a in test.Descendants("dbs") select new XElement("db", a.Element("id").Value));

If you really are interested in understand that code the you should read some article about how to crate XML with LINQ. Here are some videos http://msdn.microsoft.com/en-us/vcsharp/aa336745.aspx

Also you can go to this link.

http://blog.paranoidferret.com/index.php/2008/03/04/introduction-to-linq-simple-xml-parsing/

Hope this help.
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

In this links there are some videos. Are in VB.NET but you should be able of understand them.

http://www.asp.net/learn/linq-videos/

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

You have syntax errors. It has nothing to do with importing any namespace.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Thanks for sticking with me. Believe me I will never say tha C# and C#.NET are the same thing.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

>How many times do I have to mention Mono before you actually read it?

Sorry I forget the word 'serious'

>Are you simply trying to be selectively stupid, or are you really that dense?

The one that start being selective with the names was you so is someone is selectively stupid it's not me.

And if you haven't notice the indistinctive use of 'C#', 'Visual C#', 'C#.NET', 'Visual C#.NET'. then I think that we haven't been posting in the same thread ;-).

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

You can call MessageBox.Show("The test you want to display"); Hope this help.
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Here is my idea. Paste this into the Main method in a Console App to see it working.

string name = "camilo";
            Stack<string> s = new Stack<string>();
            string temp = string.Empty;
            foreach (char a in name)
            {

                temp += a;
                s.Push(temp);
                Console.WriteLine(temp);
            }
            for (var i = 0; i < name.Length; i++ )
            {

                Console.WriteLine(s.Pop());
            }
            Console.ReadLine();

Hope this help.
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Try this code tha use JavaScript.

<html>
<head>
    <title>Test</title>
</head>
<body>
<form>
  <input type="button" onclick="self.close();" value="Close" />
</form>
</body>
</html>

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi

>I'm willing to accept it if you want to talk about C# code that uses .NET-specific libraries

Can you tell me where its use C# outside of the .NET Framework.

>There's only one C#, and that's the C# defined by ECMA-334

Firs of all C# existed long before it was standarized. And ECMA-334 its just that.
A standard of the language.

>but using it to refer to the language as a whole is actually an insult to all of the people who work hard to keep the language from being locked in to Microsoft platforms.

C# was born at microsoft ;-).

> because it's possible to write and build C# code outside of that particular IDE.

Visual C# IDE is one of the forums in the msdn forums there is Visual C# General, and Visual C# Language(so I don't see the lock to the IDE)

"The Mono C# compiler is considered feature complete for C# 1.0 and C# 2.0 (ECMA) and also contains some of the C# 3.0 features."

As you can see C# 3.0 dosn't fallow the ECMA specification yiet. So its not C#?.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I am glad you've got my point.

As you can see all the people that post in the C# sesion in this forum or in the msdn C# Forums(a lot of them Microsoft MVP) don't say C#.NET or Visual C# because they know(as we do) that they're talking about C#.NET(There are not other C#!. that is why there is no reason for specifying, but you know that). Which leads to the conclusion tha C# and C#.NET are the same thing.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Fallowing your logic
>Because there's no need. If I say "Microsoft's C# compiler", you know that it's on .NET. If I say "Visual C#"

there is no need of say C#.Net when you say C# is the same as if you were saying C#.NET

And as you should saw in my las post "Visual C#" terms exist since 2002. And 2005 and 2008 are just the realised years. And of course that forms part of the names that represent some adds to the previous versions(Marketing).

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

>Oh, you mean the one that compares Microsoft's VB.NET compiler and C# compiler?

Why don't you call it C#.Net compiler since they call it like that almost throughout the whole article ;-)

The title is:

"Differences Between Visual Basic .NET and Visual C# .NET"

And the end is:

APPLIES TO
• Microsoft Visual Basic .NET 2002 Standard Edition
• Microsoft Visual C# .NET 2002 Standard Edition

by the way would you still said this
>There's no such thing as C#.NET in terms of official designations

> some random nameless person answering the same question who also happens to be clueless.

I give you that one but what are we :-)

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Obviously you didn't read the last link that I post.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi

>There's no such thing as C#.NET in tems of official designations.

Maybe is no 'official' bu go to this link and tell me fi you still think that is not correct that are the same thing.

http://books.google.com/books?q=C%23.net+msdn&source=citation

Also this is the description of C# int the MSDN Visual C# Developer Center.

"Visual C# is a simple, general-purpose programming language that enables you to build rich, connected Web and client applications on the .NET Framework."

My point its the closed connection C# - .Net Framework


I also found this link to another forum with the same Question

http://www.uberasp.net/forum.aspx?mode=thread&TopicID=673


I think that if any one really want to know should go here:

http://support.microsoft.com/kb/308470

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

C# and C#.NET are the same thing. You need to specify with VB because there are other VB 'versions'(e.g VB 6...) out of the .NET platform.

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

I've found this link where the compiler create the SQL delete comand for you.

http://searchwindevelopment.techtarget.com/tip/0,289483,sid8_gci866086,00.html

note: You just need to change everywhere where has OleDb for Sql

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

You can also serialize the objects. This will save the object in a file and then you can retrieve then like objects to. Among the clases that you will need to use are FileStream, StreamReader, StreamWriter,..., this clases are in the System.IO namespace. Also you need to mark the class as [Serializable]

Regards,
Camilo

camilojvarona 0 Junior Poster in Training

Hi,

Your problem is that you have deleted rows from the DataTable(this act like a cache but its not related to the fisical DB wich means that whatever you do in the DT doesn't reflecs in the DB) and not in the actual data base what you need to do is run delete domands(SQL) against the DB .

Regards,
Camilo