
pendragon
Avatar/Signature-
Posts
214 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by pendragon
-
Thanks for the reply Denaes but thats not what I am getting, I select a file then press delete and 20 seconds later it asks if I want to send the item to the recycle bin. Its just weird
-
Hi I have a strange problem that has been bugging me since we got .Net at work and decided to see if any one else has come across it. We have desktops with Windows 2000 that connect to a Novel server. The problem is, when you right-click or try to delete an item on the desktop it takes between 15-30 seconds to perform the action. This happens on both my machine that has VS.NET and the machines that only have the framework on them. Anyone got any ideas on this. Thanks
-
I have just finished testing a way of doing it, I add a column to my Datatable and set AutoIncrement to true, that way I always have an index (plus 1) for the row. Robby I don't know much about Dataview as have never used it but will have a look at what it can do.
-
Thank you for the reply Robby. I don't believe in Databinding controls either , I prefer to have more control, but the book I am using does talk about this and It seems that I would have the same problem, you can use CurrencyManager.Position to move about the table (Same as I am doing now with a Current Row Pointer) but although it shows BOF, EOF, Next and Previous there seems to be nothing for a Find method so I would not be any better off. I could get around this by making a routine to start at record one and count each record untill it finds the one they want or change the interface so that it comes up with a list first, both of these work arounds I would rather avoid. So if someone knows of a way to return the row index for the record you are looking at I would be most appreciated. Thanks
-
Hi All I need a bit of help and advice, up untill now my .NET programs have used old ADO for data access, I am now trying to convert them to ADO.NET and am wondering If some of the things I am doing are correct. The project I am working on is an Accounts/Stock/MRP/Costing and Warehouse system, all the main data access forms use the same layout, that is you go into form, it loads the data and then displays the first record. You can step through the data using buttons, Begining of File, Precious, Next , End of File and Find, in ADO 2.7 you could use the MoveFirst, MoveLast etc calls to get the records. In ADO.NET I have created my DataAdapter that has filled a DataSet and has given me a DataTable that I can work on. Now the book I am learning from says to use the DataRow object to navigate around the table ie rowPRJEmp = tblPRJEmp.Rows[RowToDisplay] I have used RowCount to get the number of records, and RowToDisplay is set at 0 to start with, then as they go through the table I +/- RowToDisplay or set it to 0/RowCount. My problem is when they find a record, again I have a set find form that will return the Primary key for the record they want, I then use tblPRJEmp.Rows.Find to get that record. I have two questions 1) How do I get the row number from the table for the record I have just found. and 2) Am I going about this the right way, it just seems a lot more complicated and long winded than ADO 2.7 I have tried reading the book again and looking at the help but my brain seems to have turned to mush, I can see the letters and words but they no longer make any sense. Any help/advice would be most appreciated. Thanks
-
Me.totalCostIn.Text = Decimal.Parse(Me.txtCostIn.Text) * Decimal.Parse(Me.txtQuantityIn.Text)
-
O'Well just have to write it all in long hand. Thanks for the Reply Bucky.
-
In VB.NET you have the With... End With Statement I was just wondering if there is something similar in C# Thanks
-
A Different Way to Do it I wanted to turn off the X in my program, the way I got around it was to leave the control box property at True and define a global boolean variable that is set to false, Only set it to true if, in my case, the quit button was clicked, then in the closing event on the form check to see if the global variable was true if not then set e.cancel = true.
-
Thanks for that Bucky. I thought SelectionStart was only set when you had highlighted some text, you learn something new every day.:D
-
I am writing a user control for number input, It also has a new property for the number of decimal places allowed and will not let you enter more than is specified. Here is what I have so far. using System; using System.Windows.Forms; namespace NumberDecimals { public class Number : TextBox { private int noOfDecimals; public int NoOfDecimals { get { return this.noOfDecimals; } set { this.noOfDecimals = value; } } public Number() { } protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if(this.noOfDecimals == 0) { if(Char.IsNumber(e.KeyChar) || e.KeyChar == (char)8) { e.Handled = false; } else { e.Handled = true; } } else { bool bFoundDecimal = false; string sNumber, sSelected; int iCount, iLength, iNoAfterDecimal, iDecimalPosition; sSelected = this.SelectedText; sNumber = this.Text; iLength = this.TextLength; iDecimalPosition = 0; if (e.KeyChar == (char)46) { if (sSelected != sNumber) { for (iCount = 0; iCount < iLength; iCount++) { if (sNumber.Substring(iCount,1) == ".") { bFoundDecimal = true; iCount = iLength; } } if(bFoundDecimal == true) { e.Handled = true; } else { e.Handled = false; } } else { e.Handled = false; } } else if (Char.IsNumber(e.KeyChar) || e.KeyChar == (char)8) { iDecimalPosition = iLength; for (iCount = 0; iCount < iLength; iCount++) { if (sNumber.Substring(iCount,1) == ".") { iDecimalPosition = iCount; iCount = iLength; } } if (iDecimalPosition == iLength || sSelected == sNumber) { e.Handled = false; } else { iNoAfterDecimal = iLength - iDecimalPosition; if (iNoAfterDecimal <= this.noOfDecimals || e.KeyChar == (char)8) { e.Handled = false; } else { e.Handled = true; } } } else { e.Handled = true; } } } } } This all works to a point. If NoOfDecimals is set to 2 and 123.45 has been entered into the textbox, if the user whats to change it to 1123.45 then at the moment they have to remove the .45 before anything else can be entered. Is there a way of finding the current postion of the curser in the textbox so I can check to see if it is to the left of the decimal. Thank You.
-
MDB with password connection problem...
pendragon replied to AlexCode's topic in Database / XML / Reporting
If the database has a Database Password I think you need to do the following conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & _ "C:\Projectos NET\Projecto BizTools\BizTools\ContabTESTE.mdb" & _ ";Jet OLEDB:database Password=blocoscont;" -
How can I add Locked property to ComboBox?
pendragon replied to goodmorningsky's topic in Windows Forms
Glad to be of help and I know what you mean about forgetting things when coding i'm always doing it.:D -
How can I add Locked property to ComboBox?
pendragon replied to goodmorningsky's topic in Windows Forms
About the DropDownList, The only reason I know for it not setting the text is If it can't be found in the ComboBox's Item List. As for you class this is the test I did using System; using System.Windows.Forms; namespace MyComboBox { public class MyComboBox : ComboBox { private bool isLocked; 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; } } } } This seems to be the same as yours but it works here, even with a button to toggle IsLocked (But as I said before it still lets me change the combobox by selecting an Item from the List). Have you done a messagebox to check the value of textLocked in the OnKeyPress event to make sure it is true, apart from that I don't know what to suggest :confused: To select the Index, Item and text on the combobox I use the following this.MyComboBox.SelectedIndex = this.MyComboBox.FindStringExact(text); To make it so that they can't select an Item in the ComboBox I added the following to the class private int iIndex = -1; protected override void OnSelectedIndexChanged(EventArgs e) { base.OnSelectedIndexChanged(e); if(this.isLocked == true) { this.SelectedIndex = this.iIndex; } else { this.iIndex = this.SelectedIndex; } } -
Set the Enabled property to True/False ie buttonName.Enabled = True;
-
How can I add Locked property to ComboBox?
pendragon replied to goodmorningsky's topic in Windows Forms
I ran a quick test to see if it was working on my machine and using the KeyPress worked, this is what I did private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (this.comboBox1.Tag.ToString() == "LOCK") { e.Handled = true; } } I used the tag property as a quick way of testing. This didn't allow me to type anything into the comboBox but it still allows you to select an item. If you don't want them to be able to select items then the easiest way to do this is by setting the enabled property to False, the only draw back is that it greys out the control. -
How can I add Locked property to ComboBox?
pendragon replied to goodmorningsky's topic in Windows Forms
The first example works if you use the KeyPress event instead of the KeyDown event -
Not sure if this is what you need as I have not started to use ADO.NET yet (Still using ADO) but I am starting to learn it from a book. It talks about NULL values and how to check for them, It says to use the following If drw2.IsNull("jobDescription") then .... else .... End If Hope This Helps.
-
I had the same problem. You need to check the contents of the database field before you copy it into your text box if(IsDBNull(databasefield) then txt_subcode.Text = "" Else txt_subcode.Text = databasefield End if I ended up making a function to do this.
-
I have managed to re-produced the error you are getting If you setup the list view with the ListViewItems collection editor/ListViewSubItems collection editor and only have the main item and six items defined, SubItem(7) and SubItem(8) will not work even if you have those columns set up. Don't know if that is how you set it up or if you are coding it somewhere. To fix either add two more items to the subitem collection or use SubItems.Add(7).
-
Me.ComboBox1.SelectedIndex = Me.ComboBox1.FindStringExact("NEW YORK")
-
Need Help on updating a txtbox from a Database
pendragon replied to trippbrown's topic in Database / XML / Reporting
Not sure if this is the same, but I had a problem that gave the same error. I had an access database with text fields, If the field was blank when it saved it put a null in the access database. When I tried to display the record I got your error. What I ended up doing was writing a function that tested the value in the field and if it was null then it returned "" otherwise it return the value. Hope this helps -
This is what I have used. private void textBox1_TextChanged(object sender, System.EventArgs e) { TextBox t; t = (TextBox)this.ActiveControl; if (t.TextLength == t.MaxLength) { this.SelectNextControl(this.ActiveControl, true, true, false, false); } } You can then set the TextChanged event for each of your text box's to textbox1_TextChanged
-
Have you had a look at the VS site at microsoft. http://msdn.microsoft.com/vstudio/
-
You need to pass a ref. for Form2 to Form3 something like Public Sub New(ByVal tform As Form) then set myParentForm to tform this will give you access to form2's controls