Jump to content
Xtreme .Net Talk

pendragon

Avatar/Signature
  • Posts

    214
  • Joined

  • Last visited

Everything posted by pendragon

  1. Thanks for that it works :)
  2. Anyone Please
  3. Sorry I think I am being a little dense today and can't seem to picture what it is you are doing. You have your data source defined in your report, are you wanting to change the grouping (which I am not sure can be done) or are you going to show one field or another depending on a criteria. Unfortunately I am about to go home and my Internet access is not working at the moment :(
  4. EFileTahi-A Sorry but I am not quite sure what you are trying to do, if you mean can you link a text object to a database field and have the contents change for each record then I don't think this can be done (Never tried so could be wrong), you can use fomulas to show different fields for each record. Could you give me a little bit more info please and I will try to help.
  5. EFileTahi-A This is a really basic program but should give an idea of what to do. Hope it helps. TestPrint.zip
  6. Hi All Is there a way that you can call the MouseLeave Event from code for a ComboBox? Thanks
  7. Never had that error so not sure what it is. I always put the code in the report viewers load event eg : private void CrystalReportViewer1_Load(object sender, System.EventArgs e) { crReportDocument = new OpenItem(); TextObject textObject; textObject = crReportDocument.ReportDefinition.ReportObjects["txtRepDate"] as TextObject; textObject.Text = "For Month Ending " + RepDate.ToString(); CrystalReportViewer1.ReportSource = crReportDocument; } Have never tried to do this from another program so not sure if you need to do anything else but if you do the above I think it will work Just to let you know these are the two namespaces I add to the program using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared;
  8. Thank you all for your replies I had forgotten about using cast, long day and my brain was complaining, only trouble with this is that I have 3 types of forms this control can go on so am not sure how I would know which type to cast it to. Having played with it to see if this would solve my problem I find that it will not, I was clutching at straws at the time so will do as PlausiblyDamp suggests and let you know the problem. I have created a comboBox (based on one goodmorningsky wrote) that has a new property on it to say if it is locked or not. using System; using System.Windows.Forms; namespace MyComboBox { public class MyComboBox : ComboBox { private bool isLocked; private int iIndex = -1; private bool MouseInControl = false; public bool IsLocked { get { return this.isLocked; } set { this.isLocked = value; } } public MyComboBox() { } protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if(this.isLocked == true) { e.Handled = true; } else { if (e.KeyChar == (char)Keys.Return) { SendKeys.Send("{TAB}"); } } } protected override void OnSelectedIndexChanged(EventArgs e) { base.OnSelectedIndexChanged(e); if(this.isLocked == true && this.MouseInControl == true) { this.SelectedIndex = this.iIndex; } else { this.iIndex = this.SelectedIndex; } } protected override void OnMouseEnter(EventArgs e) { base.OnMouseEnter(e); this.MouseInControl = true; } protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); this.MouseInControl = false; } } } The reason for this is that the system I have written has users that can only view data and others that can view and change data, the complaint I had from some of the users who can only view data was that the comboBox was difficult to read when not enabled. Because there is a large amount of data, they decided that they did not what a list of all records that they could choose from but to be able to more back and forward with buttons, type in a known key or press a find button to search. Now every thing works fine for those who just view data, the problem comes when you change the contents of a comboBox, as you can see the OnSelectedIndexChanged checks if the control is locked, this does not let them change the contents of the box but if they are moving through the database I still need to show the new data, so I use the OnMouseEnter and OnMouseLeave to set a variable and check that if it is locked, and the mouse is not in the control, then it can update the information. The trouble is that the OnMouseLeave does not fire when you change the contents of the combox so when it has been changed all records will display the same information. What I am trying to do is come up with a logical way to do this. Thanks for reading all this :D
  9. To Access it TextObject textObject; textObject = myReport.ReportDefinition.ReportObjects["TEST"] as TextObject; [/Code] Then say to change the text [Code] textObject.Text = "Some Text"; [/Code]
  10. Hi all I know know that you can use base.FindForm to get the form that your control is on, but is there any way to then access that forms variables for testing purposes. ie Form ParentForm = base.FindForm(); if (ParentForm.A_Variable == true) { // do something } else { // do something else } Thank you
  11. The SQL Statements would be 1) strSQL = "SELECT * FROM myTable WHERE String = '" & myVariable & "' ORDER BY myorder" 2) strSQL = "SELECT * FROM myTable WHERE Number = " & myVariable & " ORDER BY myorder" 3) strSQL = "SELECT * FROM myTable WHERE Date = DateValue('" & myVariable & "') ORDER BY myorder" Hope This Helps
  12. One way to do it is to use the @@IDENTITY Command and use the RowUpdated Event to get the number, This will return the last autonumber generated on the current connection. OleDbCommand GetAutoNumber = new OleDbCommand("SELECT @@IDENTITY ", cn); da_Insert.RowUpdated += new OleDbRowUpdatedEventHandler(HandleRowUpdate); private static void HandleRowUpdate(object sender, OleDbRowUpdatedEventArgs e) { if ((e.Status == UpdateStatus.Continue) && (e.StatementType == StatementType.Insert)) { e.Row[TempStr[9]] = (int)GetAutoNumber.ExecuteScalar(); } } [/Code] I am using this with an Access Database but it should work with SQL. You might want to look at the other ways SQL can do this, SCOPE_IDENTITY(), batched queries and stored procedures.
  13. Thank you for your replys You are quite right the Date field was the problem, change the name and all works ok. Think I will now go and re-read my SQL key words list, hopefully it will sink in this time :D
  14. Hi all I am trying to insert a new record into my database and am getting an error that I don't seem to be able to find. The error is as follows. Syntax error in INSERT INTO Statement. My insert statement is INSERT INTO [CostDetail] (ProjectNumber, Type, Date, Reference, Amount, Comments, Locked, LockedBy) VALUES (?,?,?,?,?,?, false, 'No One') I can't see anything wrong with it. Is there any way to find out what the program things the error is? Thanks
  15. If you have some records that do not have a relationship with the parent then the DataRelationCollection has a createConstraints option, this defaults to true. I think the following will work if this is the problem. DsOpisDM1.Relations.Add("relation", DsOpisDM1.Tables("opisDM").Columns("id"), DsOpisDM1.Tables("x_dodatnaZnanja").Columns("id_opisDM"), false) [/Code]
  16. List views have a HideSelection propery, set this to false and it will keep it highlighted.
  17. I do the same thing at work. The way I did it was do to as PlausiblyDamp suggests, I set the Login form as the 1st one loaded and after they have logged in hide the login form and do a showdialog for the main menu, when that one closes the login form then closes. this.Hide(); MainMenu LoadMenu = new MainMenu(); LoadMenu.ShowDialog(); this.Close(); [/Code]
  18. I don't believe there is any way to format a column in a listview, you can only set Text, Text alignment and Width. I use a class that takes a field and returns a string that is formatted to the way I want it.
  19. The listview has a SelectedItems property that you can use ie YourListView.SelectedItems[0].Text [/Code] Will get the text in the first column [Code] YourListView.SelectedItems[0].SubItems[1].Text [/Code] For Other Columns If you allow multi select you can use the count property to loop through all selected items.
  20. Hi all What I am trying to do is filter some data by Date, trouble is that the rowfilter will only take the date in US format and will not use my local settings that being UK. If i am doing an SQL statement to get data by date I can use the DateValue('') funtion to ensure that it use's my settings, is there something that I can use in the rowfilter command or have I not set something up right??. Thanks.
  21. Don't know if it is the same on all servers but on ours (Novel) if a file (excel or word) is already open on one computer then anyone else who opens it will only have readonly access.
  22. I have now managed to get this working, here is the solution just in case anyone else has this problem. It works with any user defined paper size. 1) Create a new form size 2) Add a printer that is just going to be for that paper size, I called it label printer. 3) On the printer properties change the device settings and the printing defaults to your user defined paper size. 4) In the code set the printer name to your new printer and set it up to print direct to the printer. crReportDocument.PrintOptions.PrinterName = "Label Printer"; crReportDocument.PrintToPrinter(1, true, 0, 0);
  23. Turns out that this is a known bug, Bussiness objects give a workaround but this does not work either!!!! Seems they have known about this since march, I am beginning to wonder if they have decided not to do any more fix's for version 2003, hopfully they have sorted it out in the next version.
  24. Hi all I am trying to write a label program, everything is fine on my machine, there are 8 labels to a page, 2 across and 4 down. I have set the report up to run on an Epson LX-300 using the windows default driver on both machines, the paper type is Fanfold 8.5in x 12in which exists on both machines and I go via the crystal report view. The problem is when I run the program on the machine that prints the labels I only get 6 on a page and a big gap at the bottom, It doesn't even go to the correct place on the second page, its as if the program has selected a different paper size for some reason. Has anybody got an idea how to fix this please, as the system is supposed to be going live soon. Thanks.
  25. Mike55 There is an option in Report Options called :- Convert NULL Field to Default The helps says: Convert NULL Field to Default Selecting this check box forces the program to convert any null values to the database field default. Some databases treat a null as zero, some as a blank, and some as a special null value. Never tried it but it might work (but then again its Crystal reports so it might not :D )
×
×
  • Create New...