Jump to content
Xtreme .Net Talk

Ice725

Avatar/Signature
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Ice725

  1. I'm trying to use MapPoint in my ASP.NET app. In the Windows-Forms example I found online, it uses a PictureBox to show the Map: MapImage tempImage = renderService.GetMap(mapSec)[0]; myPictureBox.Image = new Bitmap(new MemoryStream(tempImage.MimeData.Bits, false), true); Is there a control in ASP.NET that will allow me to set it's Image property as it shows above?
  2. Woohoo, I got it working. Thanks!
  3. I've created a class called PlayerCollection, which implements CollectionBase. But I'm not sure how to code the Team class now. After I createa new instance of Team, I am not seeing any properties displayed in intellisense. Could you assist me with this part?
  4. Thanks for the tip, I'll look into strongly typed collections.
  5. I need some help with an Indexer on a class I wrote. For simplicity, let's say the class is called Team. Some of the properties of team class are Name and City and Color. I have another class called Player, with Properties of Name, Position, and Height. Within my Team class, I have an indexer as follows. class Team { private Player[] _players; public Player this[index] { get { return _players[index]; } } } So if I'd like to get a player's name, I can do the following code: Team team = new Team(id); string playername = team[0].Name; This is working fine, but I'd like to make it a bit more like some of the controls in the .NET framework. For instance, if you want the first item in a ListBox, the code is listBox1.Items[0], how can I make my Team class have a property called Players, so my code could read like this: string playername = team.Players[0].Name; NOTE: I am filling the Player[] array within the Team class. I've created an indexer like public Player this[index] { } within the Player class, but this seems to be a dead-end because the _player array resides in the Team class. Can someone point me in the correction direction?
  6. I have a ListView with many ListViewItems. I have coded the ColumnClick event to sort the ListView. I got the code from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/listviewsort.asp Since I have many ListViewItems, it takes a few seconds to sort. During this time, the Form appears to freeze. Is it possible to implement a ProgressBar to show the status of the Sort? I have successfully created a ProgressBar, but I'm not sure how to synchronize the Sort with the ProgressBar value. Can someone get me started?
  7. Resolved: I needed to set the TableName to "Clients" and then set the MappingName of the TableStyle to "Clients" also.
  8. I've removed the idea of the DataRelations because I can't seem to get the DataGrid to display the TableStyle if the DataTable is added to a DataSet Example: //Create new DataSet DataSet myDataSet = new DataSet(); //Get All Clients in Database tblClients = Client.GetAllClients(); //Add DataTable to DataSet myDataSet.Tables.Add(tblClient); //Set DataGrid DataSource dataGrid1.DataSource = myDataSet.Tables[0]; This does NOT load the TableStyle I've created... But the following code DOES: //Get All Clients in Database tblClients = Client.GetAllClients(); //Set DataGrid DataSource dataGrid1.DataSource = tblClients; As soon as I add the table to the DataSet, the TableStyle stops working. Do I need to do something different?
  9. I've created a DataGrid with a TableStyle, I set the datasource of the DataGrid to a DataTable, and it works great. I can see the columns I specified in the TableStyle. I've loaded another DataTable and linked this new table to the existing table so my datagrid can use the DataRelation object to show these tables in same datagrid. The problem is, my TableStyle for the Parent is no longer being used. Is it possible to apply a TableStyle in this situation?, If so, how can I go about this? Here is some code snippets: private void MakeDataRelation(){ // DataRelation requires two DataColumn (parent and child) and a name. DataRelation myDataRelation; DataColumn parentColumn; DataColumn childColumn; parentColumn = myDataSet.Tables["ParentTable"].Columns["id"]; childColumn = myDataSet.Tables["ChildTable"].Columns["ParentID"]; myDataRelation = new DataRelation("parent2Child", parentColumn, childColumn); myDataSet.Tables["ChildTable"].ParentRelations.Add(myDataRelation); } private void BindToDataGrid(){ // Instruct the DataGrid to bind to the DataSet, with the // ParentTable as the topmost DataTable. dataGrid1.SetDataBinding(myDataSet,"ParentTable"); }
  10. Does anyone know of any free calendar controls in which you can add daily notes on the calendar?
  11. I have a User Control that reads Customers from a XML file and displays their information in a ListView. I have added the User Control to a Windows Form and it works fine. But now I wish to grab the Customer name (SubItems[0], or the first column) from the ListView Control when a ListViewItem is clicked/changed, and display it in a Label on the Windows Form. How should I go about doing this?
  12. Trying to find out how to do a search that is not case-sensitive, I found the following code: <?xml version="1.0" encoding="utf-8"?> <Users> <User> <Name>sonu</Name> <Password>sonu</Password> </User> </Users> </code> Code File: <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Xml" %> <%@ Page Language="C#" Debug="true" %> <script runat="server"> void Page_Load(object sender, System.EventArgs e){ if(!Page.IsPostBack){ XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Server.MapPath("user.xml")); XmlNodeList nodeList = xmlDoc.SelectNodes("Users/User[Name = translate ('SONU', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')]"); Response.Write(nodeList.Count.ToString()); } } </script> http://www.devx.com/DevX/Tip/21293 This works, except if you capitalize the first letter: Sonu, instead of the lower-case sonu, in the XML file Anyone familiar with the translate function?
  13. I have created a web user control called ColorChooser.ascx in VB.NET. I would like to use this same control in a C# Web application. How do I go about compiling or adding the control to the C# project?
  14. Hey thanks alot Kahlua, I did not know about this... Very helpful!
  15. I'm not familiar with viewstate, can you give me some sample code?
  16. I am using a DataView to Sort my DataGrid. I set the Datasource for the Datagrid to my DataView, then I bind my DataGrid. Works fine. If user selects another option, I would like to RE-Sort my already sorted DataGrid. In order to do this, I will need to obtain a DataTable to pass into the NEW DataView I am using C#.... DataView view2 = new DataView(DataGrid1.DataTable????,"TheCity='"+city+"', PlusMinus DESC",DataViewRowState.CurrentRows); [/Code] Obviously there is no DataGrid1.DataTable Property. Is there a way to extract a DataTable?
  17. I have set up the ItemDataBound, but for some reason, it addings the columns twice! I set up a breakpoint and watched the e.Item.ItemType. public void DataGrid_ItemDataBound(.....) { string thetype = e.Item.ItemType.ToString(); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Calc(e.Item.Cells[1].Text); } else if (e.Item.ItemType == ListItemType.Footer) { e.Item.Cells[0] = "Total"; e.Item.Cells[1] = myTotal.ToString(); } } I set up my DataGrid to query only 1 row from the DB. So my DataGrid has a Header row, the data row, and a footer row. I watch it loop through and I see the values of typetype as Header, Header, Item, Item, Footer, Footer... If I'm not mistaken, it should only loop through 3 times, for header, item, footer? Any ideas? I did DataGrid1.DataBind() only once, and I filled the dataset with the DataAdapter.
  18. I have been working on windows applications in VS 2003 on my new laptop for a few months. Everything works great, but for some reason, why I try and develop an ASP.NET application, the computer basically locks up after I close the IE window, or manually press the stop button within VS. Here is an example: I begin a new ASP.NET app, and simply place a button, and hit run, or F5. The first time I run this page, it usually works ok. (But not always...) So I press the stop button within VS and it closes the IE window. I try and run the application again and IE window just sits there like its trying to connect to a server. After several minutes of nothing, I go back and press the stop button inside VS. Now the stop button becomes greyed out. I press the pause button and run button... same thing. Most of my choices in the menu drop downs are also disabled. Sometimes I am able to close down VS, but usually it simply quites responding and will not close, even with the 'end now' option. I can use the start menu, and choose programs, but nothing will open. I can choose shut down PC, or restart pc, but nothing happens. After a restart, i even tried to access the ASP.NET page without even starting VS, and it did the same thing...froze up my laptop. I uninstalled and reinstalled the .net framework...same problem. Then I uninstalled .net framework AND VS 2003, and reinstalled it..... same problem. I am running Centrino CPU with XP PRO SP2 (Downloaded the SP2 patch, but not sure if it was before or after the VS/.NET install) Any ideas how I can solve this problem? I hate shutting down my new laptop by holding the power button :confused:
  19. I managed to work around it by removing the ADO.NET code from my constructor into another method, which is called by the constructor. No idea why that would help anything, but it did ... I also found an error with my SqlParameter declaration. I send an array of SqlParameters to the database class, so maybe that generated the error. If I experience this problem again, I'll post... BTW, besides using task manager in windows, is there a way to view how much resources or memory your program takes up while running?
  20. I have a C# class that handles all my database operations, I have methods to return DataSet, DataTable, Scalar, and Update or Deletes... based on the parameters and stored procedure name passed as arguments. Everything is worked fine. I am running a MDI program. In one of my child forms, I call my database class file to return me a datatable or dataset, but I keep getting an OutOfMemory exception. The datatable I'm trying to receive only has 4 rows, and 1 column... Any thoughts or ideas?
  21. To eliminate some code size in my programs, I would like to create a method that takes a parameter of SqlParameterCollection. Inside this method, I will do all the database work by creating a SqlCommand that holds all the parameters in the SqlParameterCollection that was passed in. I cannot figure out how to make this work. Here is an example: //This method creates the SqlParameterCollection public void add() { SqlCommand c = new SqlCommand(); SqlParameterCollection p = c.Parameters; p.add("@fname",SqlDbType.Varchar,25); p.add("@lname",SqlDbType.Varchar,25); p[0].Direction = ParameterDirection.Input; p[1].Direction = ParameterDirection.Input; p[0].Value = "John"; p[1].Value = "Doh"; int rows = UpdateDatabase(param); } public int UpdateDatabase(SqlParameterCollection param) { SqlCommand command = new SqlCommand(); // ... Rest of code to update the database by the command //How do I set the parameters of the param passed in?? } I tried to do something like: command.Parameters.Add(param[0]); ... but I get an error saying that @fname already exist in another parameter collection. I've tried simply printing the value of the parameters and I can see the correct values inside the method, so I know they are being passed correctly. I cannot figure out how to add them to the command, so when I do an ExecuteNonQuery, it will pass them to a stored procedure. Any ideas or solutions? Thanks
  22. Yes, I was trying to add columnHeader1 to columnHeader9 in EACH of my ListView Arrays. I dont understand why you can't do that, but I converted them into array's and it works now. Thanks
  23. When I try and run my program, I get a nasty error message that says the following: An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll Additional information: Cannot add or insert the item 'Name' in more than one place. You must first remove it from its current location or clone it. I know WHERE the problem is, but don't know how to solve it... I have a for loop when sets all the propertys for each ListView item in my Array. If I take out the following line, it works fine, but if I try and add the column headers, I get the error message above... this.lstTeam[x].Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {this.columnHeader1, ........... all the way to this.columnHeader9}); Another catch is if I just add the 1st ListView in my Array, I am able to add the column headers. It barf's on the lstTeam[1] element... Any Help?
  24. My problem is the opposite of andycharger... Say frm1 generates 5 numbers. To add a new number, frm2.showDialog() is fired. He can pick from some more numbers on this form, frm2. When he finds the one he wants, he clicks OK button. So with this example, how could i send back the number the user picks from frm2 back to the main form, frm1?
  25. Never hard-coded handlers before. I tried this, but it gives me an error saying I'm missing a ' ) expected for (int x = 0; x < 3; x++) this.txtGame[x,0].Leave += new System.EventHandler(this.txtGame[x,0]_Leave); How should my Method look?
×
×
  • Create New...