Jump to content
Xtreme .Net Talk

mjb3030

Avatar/Signature
  • Posts

    76
  • Joined

  • Last visited

Everything posted by mjb3030

  1. Try adding a blank form, in other words Form frm = new Form(); frm.MDIParent = this; frm.Show(); That will tell you if the problem is with your FrmLogin class or if the problem is something else. If that blank form displays correctly, the problem is with the FrmLogin class. If it displays incorrectly, the problem is something else.
  2. Sorry about the VB, I just noticed you were using C#. Anyway, the default values of the Windows Form should make it appear like you want. So, if you are adding the child forms like above, then there has to be something else that is causing them to maximize. I would try adding a standard, empty, default form as a child. See if it appears normally.
  3. Are you doing something similar to the following when creating the child forms? Dim frm As FrmLogin = New FrmLogin frm.MdiParent = Me ' Me, in this case, refers to MDI Parent form frm.Show()
  4. For i As Int16 = 0 To Me.ComboBox1.Items.Count - 2 For j As Int16 = Me.ComboBox1.Items.Count - 1 To i + 1 Step -1 If Me.ComboBox1.Items(i).ToString = Me.ComboBox1.Items(j).ToString Then Me.ComboBox1.Items.RemoveAt(j) End If Next Next
  5. I wonder if it is just not refreshing the screen all the way? I wrote a simple test app with an MDIParent form and a child form. I put a menustrip on the child and set the child form's FormBorderStyle to None. I put a button on the MDIParent that would add a new child form each time it was pressed. I noticed that each time I added one, for a brief second, you could see the border with the min, max, and close buttons in place. Then, the border would disappear. Since it only happens occasionally, perhaps it is not finishing the drawing of the child form. What happens if you minimize your parent form and then bring it back up? Are they still there? Edit.... Sorry, just looked again. I was thinking you had child forms with no border. If that is not the case then that probably isn't the answer.
  6. Is your WindowState property of your child forms set to Maximized? If that is not the problem, post some code to show how you are adding your child forms.
  7. Try this: Dim col As New DataGridViewTextBoxColumn() col.DefaultCellStyle.Format = "C" col.ValueType = GetType(Double) MyGrid.Columns.Add(col)
  8. This is my connection string: ConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=\\\\server1\\ldb\\labtests.mdb;" & _ "User Id=admin;" & _ "Password=" I never explicitly call conn.open(). I just do a dataadapter.fill(ds). I have never had any problems with multiple users connecting at once. It was only when I changed the rights of certain users to read only did those users have problems.
  9. I have a fairly standard db application which uses dataadapters to populate datasets from an Access database. I set up the dataadapters using the wizard, so the delete, insert, and update commands were all created automatically. I have a few users now who need to be able to view the database, but are not permitted to make changes. I figured if I just gave them read only access to the MDB file, everything would be fine, but now they cannot run the program. They get an error stating that the file is either opened exclusively by someone else ( it isn't ) or they do not have permission. My assumption is that, since the dataadapters are set up to handle deletions, updates, and inserts, they can't be instantiated. Is that correct? If so, what would be the easiest way for me to make a "lite" version of this app that would allow read only? I'd prefer not to have to go through and remove all the dataadapters and put in datareaders. If I just go through the wizard and tell it not to create the delete, insert, and update commands will that take care of things?
  10. Post your save button code.
  11. OK... found an answer about the 3 letter word thing here http://www.xtremedotnettalk.com/showthread.php?t=82560 ... is that the same reason we can't search for 'help'?
  12. I recently needed to find information about available 3rd party help compilers. I first tried to search the forum for 'chm compiler'. But, three letter words are not permitted in searches, so I received a huge list of messages with only the word 'compiler' in them. I then tried to search for 'help compiler', but was informed that the word 'help' is too common and would not be included in my search. I realize that is a common word in a help forum, but why can't I have the option of including it in my search? It may take me a few tries, but I think I could whittle the results down to where I can find what I'm looking for. And, why can't we search for 3 letter words? In other forums, it might make sense to exclude them, but in a programming forum? ( ASP, PHP, EXE, CHM, VBC, GDI, DLL, etc. ) Having said that, I will say this: I love this forum. I have learned so much from all the extremely knowledgeable people here. After I start Visual Studio each day, the very next thing I do is open my browser and come here. I use this as a programming tool as much as I use MSDN. So, I do a lot of searches here. That is why I mention the above issue.
  13. I am trying to retrieve a web page using tcpclient. It works, but if the page is very long, it always gets cut off. For example, I can receive the full page for http://www.google.com, but if I retrieve a google search page, the server disconnects halfway through and I only get half the page. Here is my code: client = New TcpClient client.Connect(txtURL.Text, 80) stream = client.GetStream Dim send() As Byte = Encoding.ASCII.GetBytes("GET / HTTP/1.0" & vbCrLf & _ vbCrLf) stream.Write(send, 0, send.Length) Dim recv(client.ReceiveBufferSize) As Byte While Not stream.DataAvailable Application.DoEvents() End While While stream.DataAvailable stream.Read(recv, 0, client.ReceiveBufferSize) Dim s As String = Encoding.ASCII.GetString(recv) TextBox1.Text = TextBox1.Text & s End While What should I be doing differently? (Besides eliminating the infinite DoEvents loop)
  14. Thank you!! You have solved my problem. Actually, I've had this same problem in the past with other projects also. So, you have solved several problems. I was not aware of the thread/control issue.
  15. Thank you for your help. Unfortunately, that didn't work. Yes, the textbox does have the focus because it is the only control on the form. I also added a TextBox1.Focus line just to be sure. I made the changes you suggested, and it still did the same thing. I also tried using TextBox1.ReadOnly to control when it could be input instead of using the Boolean flag and the Keypress event. That didn't work either. I am not trying to make the text flash. This little program was created only to solve this problem. I have a larger, more useful program for inputting tire treadwear data ( I work for a tire testing company ) in which I am encountering this problem. The data is coming from a depth probe plugged into the serial port. The timer is reading data from the probe. I don't want people to be able to type data into the textboxes. I tried just setting the Text property, but I had a lot of problems with events not firing when necessary in order to handle validation and moving from one textbox to the next. I don't remember exactly what the problems were now. But, it's starting to look like I am going to have to go back and work out those problems because the SendKeys method is beginning to look like less of an option.
  16. I have a form with one textbox and a timer on it. Other than the Form Designer generated code, this is all that is in my form: Private AllowKeys As Boolean Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As KeyPressEventArgs) Handles TextBox1.KeyPress If Not AllowKeys Then e.Handled = True End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AllowKeys = False Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick AllowKeys = True SendKeys.Send("hello") AllowKeys = False End Sub If I try to type in the TextBox, nothing appears, which is as it should be. But, I would expect the word 'hello' to appear in my textbox every 5 seconds (the timer is set to 5000). But, it does not. Also, if I add a break point at either the Timer1_Tick event or the TextBox1_KeyPress event, the application will actually lock up when the timer event hits! I am assuming that it has something to do with the fact that it is a timer doing the sending. Why is this happening? Is there some way around it while still using SendKeys?
  17. AlreadyChecked is just an array of Boolean values that indicates whether a particular cell has already been validated. It does not change or even access any table data.
  18. Thanks. I appreciate it. I will check this out. I decided to use textboxes for my current problem instead of a datagrid because I have a fixed number of rows and columns. I was just hoping the datagrid would make things a little easier. I still haven't figured out why the column data would change in the middle of the ColumnChanging event handler. Maybe the .NET 2.0 datagrid will be the cure for our ailments.
  19. I am completely stumped. I have a datagrid that is acting very strangely. The following method handles the ColumnChanging event of the underlying table: Private Sub tbl_ColumnChanging(ByVal sender As Object, _ ByVal e As System.Data.DataColumnChangeEventArgs) Handles _ tbl.ColumnChanging If Not IsNumeric(e.ProposedValue) Then e.Row.SetColumnError(e.Column, "You must enter a number") Exit Sub End If If AlreadyChecked(dgrData.CurrentCell.RowNumber, dgrData.CurrentCell.ColumnNumber) Then Exit Sub End If AlreadyChecked(dgrData.CurrentCell.RowNumber, dgrData.CurrentCell.ColumnNumber) = True Dim LastPoint As Int16 ' The TreadData class simply returns an OLEDBDataReader ' when I pass it an SQL statement. It works fine throughout ' the rest of my program. Dim tdMaxPoints As TreadData = New TreadData("SELECT MAX(Point_ID) AS MaxPointID " & _ "FROM Points INNER JOIN " & _ "(Grooves INNER JOIN (Tires INNER JOIN Tests ON Tires.Test_ID = " & _ "Tests.Test_ID) ON Grooves.Tire_ID = Tires.Tire_ID) ON Points.Groove_ID " & _ "= Grooves.Groove_ID WHERE GrooveNumber = " & dgrData.CurrentCell.RowNumber - 1 & " AND " & _ "PointNumber = " & dgrData.CurrentCell.ColumnNumber) While tdMaxPoints.TreadReader.Read Dim tdPoints As TreadData = New TreadData("SELECT Measure FROM Points " & _ "WHERE Point_ID = " & tdMaxPoints.TreadReader("MaxPointID")) ' Right after the previous line, before the next line, my code ' jumps back to the beginning of this method. While tdPoints.TreadReader.Read 'Do Stuff End While End Sub At the point I indicated in the code, my app jumps back to the beginning of that method. Apparently, the underlying table changes in the middle of the ColumnChanging event?! When I check the proposedvalue on the second pass through, it shows an empty string instead of the value that had been entered. The only thing I could think of was another thread changing something. I have one other thread running which is listening for input from the serial port. But, I tried disabling that thread, and I got the same behavior. I also am experiencing strange behavior with the method that is handling the Enter event for all of the textboxes on my datagrid. I think this may be related. If I put an 'Exit Sub' at the beginning of the ColumnChanging event so as to bypass it, the TextBox_Enter method exhibits the following behavior: It will perform the method twice for each textbox. But, only if I have changed a value in the previous textbox. In other words, only when the ColumnChanging event occurs. If I tab to another textbox without changing the value, the Enter event only happens once. Private Sub dgrData_TextBox_Enter(ByVal sender As Object, ByVal e As _ EventArgs) If dgrData.CurrentCell.ColumnNumber = dsMeasures.Tables(0).Columns.Count - 2 And _ dgrData.CurrentCell.RowNumber = dsMeasures.Tables(0).Rows.Count - 1 Then btnDone.Focus() Exit Sub ElseIf dgrData.CurrentCell.ColumnNumber = dsMeasures.Tables(0).Columns.Count - 2 Or _ dgrData.CurrentCell.ColumnNumber = dsMeasures.Tables(0).Columns.Count - 1 Then Dim r As Int16 = dgrData.CurrentCell.RowNumber dgrData.CurrentCell = New DataGridCell(r + 1, 1) ElseIf dgrData.CurrentCell.ColumnNumber = 0 Then Dim r As Int16 = dgrData.CurrentCell.RowNumber dgrData.CurrentCell = New DataGridCell(r, 1) ElseIf dgrData.CurrentCell.RowNumber > NumGrooves - 1 Then dgrData.CurrentCell = New DataGridCell(dsMeasures.Tables(0).Rows.Count - 1, 1) End If End Sub Any thoughts?
  20. OK. That's what I needed to know. Thanks.
  21. I have four tables: Tests, Tires, Grooves, Points. They are related this way: Tests to Tires: 1 to many: Tests.Test_ID = Tires.Test_ID Tires to Grooves: 1 to many: Tires.Tire_ID = Grooves.Tire_ID Grooves to Points: 1 to many: Grooves.Groove_ID = Points.Groove_ID Each test may contain 16 tires. Each tire may contain 6 grooves. Each groove may contain 60 points. So, as you can see, if I want to delete one test along with all its related data, there could be a lot of records to delete. I would love it if I could do it all with one SQL statement rather than having to loop through every groove to get the points, every tire to get the grooves, etc. I've been looking around for the answer, and this is what I have right now: DELETE Points.*,Grooves.*,Tires.*,Tests.* FROM Points INNER JOIN (Grooves INNER JOIN (Tires INNER JOIN Tests ON Tires.Test_ID = Tests.Test_ID) ON Grooves.Tire_ID = Tires.Tire_ID) ON Points.Groove_ID = Grooves.Groove_ID WHERE Tests.TestNumber = 'ABC123' I have also tried something like this: DELETE FROM Points,Grooves,Tires,Tests WHERE Points.Point_ID IN (SELECT * FROM Points INNER JOIN (Grooves INNER JOIN (Tires INNER JOIN Tests ON Tires.Test_ID = Tests.Test_ID) ON Grooves.Tire_ID = Tires.Tire_ID) ON Points.Groove_ID = Grooves.Groove_ID WHERE Tests.TestNumber = 'ABC123' Neither of those work. Can anybody point me in the right direction? Thanks
  22. I just checked yours again. The only reason yours works is because when you show the child form, you are not actually creating a child form. You were doing this: Dim child As New mdiChild() child.ShowDialog(Me) If I change it to this: Dim child As New mdiChild() child.MdiParent = Me child.Show() in order to create an MDI child form, it has the same problem I'm having with mine. Try it out. Put a button near the bottom of the form. Move your mouse up onto the button from below it. The form will close. I figured out the reason is because it sees the form's desktop location as being relative to the MDI Parent instead of relative to the screen. So mdiChild.Bounds = {0,0,width,height} if the form is just below the MDI Parent's title bar and menu bar. However, Control.MousePosition still shows the mouse position relative to the screen. So, that is why I'm having so much trouble. I appreciate your help, though. You gave me the method I need to use to fix this. I think if I just add the Parent's top and left border into the equation, I will have what I need.
  23. Right! It is telling me that my mouse position is at Y=672 when I am hovering over the button which is on my form. But the form, apparently, has a lower bound of 665! So, it is obviously closing the form because 672 is not within the bounds 330-665. But my button, which is where my mouse pointer is when the form closes, is definitely within the bounds of my form. This makes no sense at all. I don't see any reason this would be happening. To sum up: myForm.Bounds.ToString = {X=0,Y=330,Width=300,Height=335} while, at the SAME TIME, when I mouse over a button on myForm: Control.MousePosition.toString = {x=52,y=672} So, the Y of a point on myForm.myButton is greater than the lower bound of myForm. ????
  24. Yeah, I did that. I had already changed it back to the way you had it. Same result. Check out my last post. Why is it showing that a point on my button is not located within the bounds of the form?
  25. I changed it to If Not rBounds.Contains(Control.MousePosition) Then like you had it instead of btnTestEditor.MousePosition. It still isn't working. If I leave the bounds of the form, it closes, like it should. But, it also closes when I mouse over the buttons. I added this line: MessageBox.Show(rBounds.ToString & "--" & Control.MousePosition.ToString) so I could see what it was testing, and this is what it gave me: {x=0,y=330,width=300,height=335}--{x=52,y=672} If the form's y is 330 and its height is 335 then its lower bound is 665 which means the point (52,672) is not in there! Why would it be saying that? The button is on that form. It's not even close to the edge! What am I missing?
×
×
  • Create New...