Jump to content
Xtreme .Net Talk

haroldjclements

Avatar/Signature
  • Posts

    47
  • Joined

  • Last visited

haroldjclements's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello All, If I have a MessageBox with an 'Ok' and a 'Cancel', how do I create a function (or method) for each of these buttons? e.g. If I press 'Ok' it will access the new form and if I press 'Cancel' it remains in the form from which the button was originally pressed. Any help will be very much appreciated. Thanks, Harold Clements
  2. Hello, I think this will be an easy question to answer for an experienced .NET programmer. Can you change the colour of the text in a textbox that disabled? I have a light grey background to the text box which makes the text very difficult to read. Any help will be very much appreciated, Harold Clements
  3. Thanks very much, Stustarz, but that�s not quite what I am trying to get at (or I have completely misunderstood). When you use the LabelEdit property you can double click the desired line in the listView and it will allow you to edit the label row data but not any of its subitems. I was wondering whether there is a way that you can edit these subitems without having to create a new form and getting the user to input the changes there. Thanks again, Harold Clements
  4. Does anyone know how you can edit the subitems of the listView in the same way as you can the items text labels (this first item in the row)? Setting the LabelEdit property to true only effect the main item labels of the row not any of the subitems. Thanking you in advance, Harold Clements
  5. That is brilliant, thanking you both so kindly. Harold Clements
  6. .ShowDialog Method Thanks for your replay PlausiblyDamp Sorry for asking but how does the .ShowDialog method work? Thanks again, Harold Clements
  7. Hello, I have a thread question that has been bugging me for some time. If you are in the middle of an event (button1_click) and you call another form to be initialised. How can you pause the button1 event, work with the new form, when finished with the new form, hide it and carry on with the rest of the button_1 event? What I am trying to do is have a form that collects items from a database. If the item number is not known then a search button can be pressed (button1) and a search form (new form) be displayed where the used can search for the item within the database. When they have found the item that they are looking for they close the search form and button1 uses a �get� method to retrieve the value that you user found in the previous form. Now I can get it to work except that it looks for the get method instantly. I want it to look for the �get� method after the search form has been close. Is there a way of pausing this thread until the search form is closed? This in advance, Harold Clements
  8. The whole method Sorry, yes the whole method looks like this: Thanks for you help, Harold. private void printBOM(System.Drawing.Printing.PrintPageEventArgs e) { Brush b = new SolidBrush(Color.get_Black()); Brush br = new SolidBrush(Color.get_LightGray()); Font f = new Font("Courier New", 9, FontStyle.Regular); String sql = "SELECT ComponentPart, ComponentID, ComponentDescription, ManufactureShortForm, " + //0-3 "ComponentShortForm, ManufacturePartNumber, ComponentQuantity, ComponentIdent, " + //4-7 "tblKitParts.EngineeringChangeNoteID " + //8 "FROM tblKitParts, tblComponent, tblManufacture, tblComponentType " + "WHERE MotherLevel = " + partNo + " " + "AND ComponentID = ComponentPart " + "AND ManufactureID = ManufactureCode " + "AND tblComponentType.ComponentTypeID = tblComponent.ComponentType "; try { int k = 0; //not used x = minX; //reset X position OleDbCommand oc = new OleDbCommand(sql, myConnection); myConnection.Open(); OleDbDataReader dr = oc.ExecuteReader(); while (dr.Read()) { k ++; //Different colour for each line printed if (k % 2 == 0) {br = new SolidBrush(Color.get_LightGray());} else {br = new SolidBrush (Color.get_WhiteSmoke());} x = minX; e.get_Graphics().FillRectangle(br, x, y, maxX, cr); //Print solid blocks e.get_Graphics().DrawString(System.Convert.ToString(dr.GetInt32(0)), f, b, x, y); x += 45; e.get_Graphics().DrawString(dr.GetString(4), f, b, x, y); x += 45; e.get_Graphics().DrawString(dr.GetString(2), f, b, x, y); x += 320; e.get_Graphics().DrawString(System.Convert.ToString(dr.GetInt32(6)), f, b, x, y); x += 45; e.get_Graphics().DrawString(dr.GetString(3), f, b, x, y); x += 45; if (dr.IsDBNull(5)) {e.get_Graphics().DrawString("", f, b, x, y);} else {e.get_Graphics().DrawString(dr.GetString(5), f, b, x, y);} x += 320; if (dr.IsDBNull(8)) {e.get_Graphics().DrawString("", f, b, x, y);} else e.get_Graphics().DrawString(getECNData(dr.GetInt32(8)), f, b, x, y); getAlternative(e, dr.GetInt32(0), partNo, br); x = minX; //Reset X Position e.get_Graphics().FillRectangle(br, x, y, maxX, cr); //Print blocks e.get_Graphics().DrawString("Locations:", f, b, x, y); x += 90; if (dr.IsDBNull(7)) {e.get_Graphics().DrawString("", f, b, x, y);} else {e.get_Graphics().DrawString(dr.GetString(7), new Font("Courier New", 9, FontStyle.Bold), b, x, y);} y += cr; //Next line if ((y+(cr*2)) >= maxY) { e.set_HasMorePages(true); y = minY; } else {e.set_HasMorePages(false);} } myConnection.Close(); } catch (Exception error) { MessageBox.Show (error.toString() + extraErrorInfo, "Exception Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.InvalidOperationException error) { MessageBox.Show (error.toString() + extraErrorInfo, "InvalidOperationException Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Data.OleDb.OleDbException error) { MessageBox.Show (error.toString() + extraErrorInfo, "OleDbException Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.NullReferenceException error) { MessageBox.Show (error.toString() + extraErrorInfo, "NullReferenceException Error:", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { x = minX; //Reset X. y += 8; //Move page down. e.get_Graphics().DrawLine(new System.Drawing.Pen(Color.get_Blue(), 1), //Blue line new System.Drawing.Point(x, y), new System.Drawing.Point(maxX, y)); e.get_Graphics().DrawString("*** End of Listing ***", new Font("Courier New", 9, FontStyle.Bold), new SolidBrush(Color.get_Black()), x, y+3); y = minY; x = minX; } }
  9. Simplified .Net Printing in C# This may help! http://www.codeproject.com/useritems/Printing.asp I can now print but can't get multiple pages! Thanks, Harold
  10. Hello, I am trying to print on multiple pages but I can not seem to be able to get it right. I have a while loop that is pulling info from a database (the results of an SQL search). I know where the bottom of the page is so I added this: (line > maxPage) { e.hasMorePages(true); line = 0; } else { e.hasMorePages(false); } However, I do not get a new page. It prints over the original. If anyone has any ideas I would be very grateful. Thanks, Harold Clements (Please note that I am using J# but I can translate answers in C# or VB.NET.)
  11. Ok found it: if (myDataReader.IsDBNull(5)){textBox3.set_Text("");} else {textBox3.set_Text(myDataReader.GetString(5));} Cheers, Harold Clements
  12. Hello, I know it�s been a long time since your post but I have come across the same problem again. How would you check to see if the item being dragged from the database is null? If I use the �myDataReader.GetString(x)� within an �if� statement then I still get the error, so presumably I need to test the object before the conversion. My question is how? Thanks in advance, Harold Clements
  13. Now can you get the data that resided at the index that has just been selected? Thanks again, Harold Clements
  14. Hello, I am using a listView object to hold three columns of data pulled out of a database. What I want is the used to be able to click a line and the index and column data be available to be used within the next part of my program. I know that the listBox object has a .get_SelectedIndex() method. However the listView does not have this method. If anyone has any ideas I will be very grateful. Thanks, Harold Clements
  15. Sorted it :D Rather then declare the columns and the headers together, I created a ColumnHeader object and then used the .set_Width() method. It works fine, so I am happy. Cheers everyone, Harold Clements
×
×
  • Create New...