Jump to content
Xtreme .Net Talk

kejpa

Avatar/Signature
  • Posts

    321
  • Joined

  • Last visited

Everything posted by kejpa

  1. Hey there, new day, new possibilities... To make errors? ;) So, I've done an extensive search.... and found the answer! (Sing of happiness sing of Joy, I was here before Killroy...) Use Invoke Dozens of places, all the same Use Invoke Soooo, I did and it failed. Back on the same spot again. Can anyone help me out here? I'm posting my test code, a form with a datagrid and a button. The button starts the damn thingy. :) Public Class Form2 Private oRnd As cRandomizer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click oRnd = New cRandomizer AddHandler oRnd.NewData, AddressOf UpdateDatagrid End Sub Private Sub UpdateDatagrid(ByVal dt As DataTable) Dim arg As Object = dt DataGrid1.BeginInvoke(New UpdateGrid(AddressOf UpdateDG), arg) End Sub Private Delegate Sub UpdateGrid(ByVal dt As DataTable) Private Sub UpdateDG(ByVal dt As DataTable) DataGrid1.DataSource = dt End Sub End Class Friend Class cRandomizer Private trdmodRandomMaker As Threading.Thread Private fmodAlive As Boolean Private dtmodRandom As DataTable Public Event NewData(ByVal dt As DataTable) Public Sub New() Dim dr As DataRow Dim i as Integer dtmodRandom = New DataTable dtmodRandom.Columns.Add(New DataColumn("Number", GetType(System.Int32))) dtmodRandom.Columns.Add(New DataColumn("Frequency", GetType(System.Int32))) For i = 1 To 10 dr = dtmodRandom.NewRow dr(0) = i dr(1) = 0 dtmodRandom.Rows.Add(dr) Next dtmodRandom.AcceptChanges() fmodAlive = True trdmodRandomMaker = New Threading.Thread(AddressOf RandomMaker) trdmodRandomMaker.Start() End Sub Private Sub RandomMaker() Dim iNumber As Integer Do While fmodAlive Threading.Thread.Sleep(1000) iNumber = CInt(10 * Rnd()) + 1 dtmodRandom.Rows(iNumber)(1) = CInt(dtmodRandom.Rows(iNumber)(1)) + 1 RaiseEvent NewData(dtmodRandom) Loop End Sub Protected Overrides Sub Finalize() fmodAlive = False trdmodRandomMaker = Nothing MyBase.Finalize() End Sub End Class ANY help appreciated! Regards /Kejpa edit: Alright, guilty. I am using VB2005, and it obviously doesn't work like .NET 1.1....
  2. Hi, this has surely been asked many times but I can't find the appropriate thread... Sorry :( I have a datatable that gets updated from a separate timer thread. I want to see the current records of the datatable in a datagrid on a test form of mine. But when the timer has elapsed and the table is updated I get an error that the grid is not updated from the form thread. plz help me.... TIA /Kejpa
  3. How about putting the XML file in a directory you can't access through the webbrowser? HTH /Kejpa
  4. I would do subselect... The records will show the User_ID if it's in the Interest_log table and you can set the checkboxes to true in those cases. If it's DBNull it's not a selected Interest HTH Kejpa
  5. Why not use a datagrid? There's a lot of articles on how to have a dropdown in a datagrid http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q480q is just one and a good place to find other tricks or treats ;) HTH /Kejpa
  6. Thanx Joe! Have to do it in vb though... As I'm not fluent in c# and as my boss can't spell anything else... I'll try to convert it myself ;) Once again, thanks a bunch. Regards Kejpa
  7. Hi, I'm about to build a filter class in which I will hold a small number (10-50) of pairs (x,y). I need to calculate average, sum and some other statistical functions on the pairs. The number of pairs is fixed for each object that holds the filter but it has to be changeable from outside the class. In VB6 we used a Collection to do this, I'm curious to wheather there's a better way now (and in vb2005). Should I inherit from "Collection" or just have an internal collection? Is Queue the right object? Regards /Kejpa
  8. If you want to count ALL rows where UPPER(O.ox_organname) LIKE '%SIGNAL%' and not split on individual organnames use... HTH Kejpa
  9. Hey! Use ordinary SQL... All brands for SupplierID= 1: SELECT b.* FROM Brands b INNER JOIN Supplier_Brands sb ON b.BrandID=sb.BrandID WHERE sb.SupplierID=1 All suppliers for BrandID=1 SELECT s.* FROM Suppliers s INNER JOIN Supplier_Brands sb ON s.SupplierID=sb.SupplierID WHERE sb.BrandID=1 hth Kejpa
  10. Hi, Haven't tried it (and I know giving non-tested tips is a death penalty crime...) but what if you create a new row, put the row to be copied into that row and then add it to the destination table? dim NewRow as DataRow=m_dtItem.NewRow NewRow=m_dtOrgItem.Rows(0) m_dtItem.Rows.Add(NewRow) HTH Kejpa
  11. Hi! I was in the beginning of fiddling with this using Access when my project died :( Access has some built in features for handling syncronized databases that is supposed to work no matter if you have two clients who have done inserts or updates to records. And it's possible to call those functions from an external program. I think it's called replication, you have one master database and a number of replicas. Changes made in the replicas will be added to the master and changes done in the master after the replica is made are done in the replica when you syncronize. I have some vague memory of options in the syncronization but you better check the documentation. As I said, I have just scratched a little on the surface of this. Good luck! /Kejpa
  12. But. If you have look at my code you will notice that I'm not using the SelectedIndex even. I'm using the SelectedValue, the SelectedValue isn't changing when new Items are added, is it? Another thing, I'm not using the "Handles", I'm adding the handler after the items are added to the Combo. The event is fireing when I change to the tab where the Combo is located not when the items are loaded. Also, the event is fireing when I drop down the list and select the same item. Temporarily I'm solving this by a static variable in the event handler, but it's not the way I want it to be... Regards /Kejpa
  13. Hi, I have a combobox that contains four items and it's located on a tab that isn't visible when I show the form. When the tab becomes active the SelectedValueChange event is fired once for each item 'FormLoad.... Dim oTraceList As New ArrayList() oTraceList.Add(New cComboItem(TraceLevel.Off, "Trace off")) oTraceList.Add(New cComboItem(TraceLevel.Info, "Info")) oTraceList.Add(New cComboItem(TraceLevel.Warning, "Warning")) oTraceList.Add(New cComboItem(TraceLevel.Error, "Error")) oTraceList.Add(New cComboItem(TraceLevel.Verbose, "Verbose")) cboTraceLevel.DataSource = oTraceList cboTraceLevel.DisplayMember = "Display" cboTraceLevel.ValueMember = "Value" cboTraceLevel.SelectedIndex = -1 AddHandler cboTraceLevel.SelectedValueChanged, AddressOf cboTraceLevelChanged cboTraceLevel.SelectedIndex = 0 'FormLoad continues.... Private Sub cboTraceLevelChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Static iSelectedValue As Integer MsgBox("Old:" & iSelectedValue & vbNewLine & "New:" & cboTraceLevel.SelectedValue) iSelectedValue = cboTraceLevel.SelectedValue End Sub Public Class cComboItem Private iValue As Long Private sDisplay As String Private iImageIndex As Integer = -1 Public Overrides Function ToString() As String Return sDisplay End Function Public Sub New(ByVal Value As Long, ByVal Display As String) iValue = Value sDisplay = Display End Sub Public ReadOnly Property Value() As Long Get Return iValue End Get End Property Public ReadOnly Property Display() As String Get Return sDisplay End Get End Property End Class When I click on the selected value the event also fires. This doesn't seem like it's supposed to work? At least not according to my head ;) /Kejpa
  14. Hi, has anyone an ImageCombo control like VB6? There's one at http://www.codeproject.com/vb/net/ImageComboBox_VBNET.asp but it doesn't show the selected Image Regards Kejpa
  15. Alright, makes sense. However, if you have the other program to sort when it reads the database you'd be much happier ;) To be sure they're written in the correct order I guess you would have to write them one at a time to the database. Some databases ignore the order they're written and some don't. Let's just hope yours do :) HTH Kejpa
  16. Why do you want to save the records in a particular order?!? Relying on records to be stored in a certain order is bad practice. Kejpa
  17. Doesn't two panels and three splitters do the trick?!? Add one panel, add the vertival splitter, add the second panel. To each of the panels add your first picture box (or what-ever) and then a horizontal splitter and the second picture box. HTH Kejpa
  18. The old VB6 TabStrip sucked, can't understand why they used it as base for a new TabControl. The old TabbedDialog had everything the TabStrip had + a number of useful features. IMHO I guess I will submit some suggestions at the page you pointed me to. Thanx for your effort /Kejpa
  19. Alright, they inherit from Control and that's why it's there, but MS could have chosen to have it declared Protected or Private then it wouldn't have been visible, no?
  20. Hi, I'm probably too worked out to see what's wrong. I can't hide one of the tabs of my tabcontrol. tabSecret1.Visible=false tabSecret1.Hide don't change a thing, the secret tab is still there :( Help me, plz! /Kejpa
×
×
  • Create New...