Jump to content
Xtreme .Net Talk

dizzy_boy

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by dizzy_boy

  1. It didn't work. It is the same as before.
  2. Thanks, I'll try that and let you know how I did.
  3. Hello to all! I have a groupbox with textboxes used to enter data. In GroupBox Leave event I chech if all of the data was entered, if not the focus returns to the text bax that was left blank. How do I prevent this from happenin when a specific button outside this group box was clicked. I wan this event to happen every time Group Box was left except when I click Cancel (also includes leaving groupbox). How, how, how?
  4. I was putting it together from scratch and I never worked in VB6. I'm doing some ASP so maybe the string operations could be better but these worked and I fine with it for now. I'll look into Random! Thanks
  5. Hello to all! I'm often playing on the lottery and I'm tired of making up numbers to cross so I came up with this little program. It should produce a predetermined amount of random number sequences of predetermined lenght. For instance 8 numbers from 1 to 39. It allways goes from 1. I'm wondering am I doing this the right way and are these numbers "random enough" ? Or can I enhance my code somehow ? Thanks! Here is just a btn Click Event: Private Sub btnGen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGen.Click Dim niz() As Integer Dim br, arl, gg, i, j As Integer Dim dobitna As String Dim da As Boolean = False If Me.radio645.Checked Then If Me.chkSistem.Checked Then arl = Me.numUD.Value Else arl = 6 End If gg = 45 Else If Me.chkSistem.Checked Then arl = Me.numUD.Value Else arl = 7 End If gg = 37 End If For j = 0 To CInt(Me.txtBK.Text) - 1 ReDim niz(arl - 1) For i = 0 To arl - 1 Do Until da Randomize() br = CInt(Int((gg * Rnd()) + 1)) If niz.IndexOf(niz, br) = -1 Then niz(i) = br da = True End If Loop da = False Next niz.Sort(niz) For i = 0 To arl - 1 Select Case i Case 0 dobitna = CStr(niz(i)) Case arl - 1 dobitna = dobitna & "," & vbTab & CStr(niz(i)) & vbTab & vbTab & vbTab & vbTab Case Else dobitna = dobitna & "," & vbTab & CStr(niz(i)) End Select Next If j = 0 Then Me.listK.Items.Add("") Me.listK.Items.Add("----------------------------------------------------------------------") Me.listK.Items.Add(dobitna.ToString) Else Me.listK.Items.Add(dobitna.ToString) End If niz.Clear(niz, 0, arl) dobitna = "" If (j + 1) Mod 8 = 0 Then 'Me.listK.Items.Add("") 'Me.listK.Items.Add("----------------------------------------------------------------------") Me.listK.Items.Add("----------------------------------------------------------------------") Me.listK.Items.Add("") End If Next End Sub
  6. First day after my vaccation, the solution just poped out: I just set CausesValidation Property of the textboxes to false and everything works fine. Who says vaccation is just a vaste of time!
  7. Sorry, for no reply, but I'm on vaccation for the next 10 days. Yes the textbox is bound to a typed dataset table. I will try your suggestion when I get back, and get back to you with the result. Thanks
  8. Does anyone have a clue where the problem is. I have a data entry form with databound textboxes. When I'm in a textbox that contains a datetime value and I press Del key, and then leave this box, the date value just reapears. So there is no way to clear once entered date. On other boxes that contain just text this doesn't happen. I'm using this code to format the date so the user just enters for instance 040804 for 04.08.2004 , but even without this code the value stays in no matter how I clear it. It also doesn't format as a ShortDate string despite: udt = Date.Parse(udt).ToShortDateString Can anyone help me. Private Sub editdatum_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles editdatumu.Leave, editdatumr.Leave, editdatump.Leave Dim udt As String udt = CType(sender, TextBox).Text If udt > "" Then Try If udt.IndexOf(".") = -1 Or udt.IndexOf(",") = -1 Then udt = udt.Insert(2, ".") udt = udt.Insert(5, ".") End If udt = Date.Parse(udt).ToShortDateString CType(sender, TextBox).Text = udt CType(sender, TextBox).BackColor = Color.White Catch ex As System.Exception Dim potvrda As MsgBoxResult potvrda = System.Windows.Forms.MessageBox.Show("Neispravan datum!" & Chr(13) & ex.Message, "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) If potvrda = MsgBoxResult.OK Then CType(sender, TextBox).BackColor = Color.Yellow CType(sender, TextBox).Focus() CType(sender, TextBox).SelectAll() Else CType(sender, TextBox).BackColor = Color.White End If End Try Else CType(sender, TextBox).BackColor = Color.White End If End Sub
  9. I solved the problem! I'm using Lhotka's vbReport tool. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet01282003.asp I added a format property to ReportColumn class, then I added it as a format parameter in ReportColumnCollection's Add method. This way I can supply a format like this for instance: report.Column(4).Format="d" Then in ReportDocument class in a sub that generates the report I check if a format for a column is supplied and then format its date representation accordingly.
  10. Mr. Lhotka suggested the same thing. He said I should add a format property to my ReportDocument Class and then supply the format as I'm printing the page. I got his e-mail yesterday so I didn't had a chance to try it but for now I'm not sure how am I to do this (I'm a begginer). I think I should first read those chapters which I skipped - "Bulding custom classes and controls".
  11. Hi there! I have a little problem. I have a DateTime(ShortDate) column in my Access db. I'm tryig to print a report of this data and I want the date colums to show only the date and not date+time (it shows for instance 23.07.2004 0:00:00 andI want only 23.07.2004). In a data grid it shows 23.07.2004 but when I fill the data like this Dim ds As DataSet() Me.OleDbDataAdapter.Fill(ds) and send it to a report document (vbReport by Rocky Lhotka) the date column shows 23.07.2004 0:00:00. Is there a way to format this DataColumn to ShortDate. On what level should this be done? SELECT statment, DataSet or something else?
  12. I was wondering what is the difference between: MessageBox.Show("message") and MsgBox("message") When is best to use one and when the other, beside already mentioned circumstances.
×
×
  • Create New...