Jump to content
Xtreme .Net Talk

gearbolt

Members
  • Posts

    14
  • Joined

  • Last visited

gearbolt's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hey dsgreen57 what was the name of that book that had the splash screen code. The link does not work.
  2. The SP those work but I questioned the results becasue SQL generated another SP the used cross joins and they were not neccsary. My SQL is not that good but I know you do not need cross joins when selecting two fields in the same table. Thanks for the help as always.
  3. This procedure was created by SQL Server and I was wondering was the code generated correct. I am not sure if the Inner Joins are correct. I am trying to select all of the accounts from the table called "tbl_Accounts" and instead of returning the ID number of each foreign key I want to return the actual data. For example 1 = Savings 2 = Checking 3 = 401K I have included the sp and the tables below. Thanks Select dbo.tbl_Accounts.Account_ID_Number, dbo.tbl_Accounts.char_Account_Name, dbo.tbl_Accounts.date_Account_Open_Date, dbo.tbl_Accounts.date_Account_Closed_Date, dbo.tbl_Accounts.int_Account_Balance, dbo.tbl_Accounts.int_Account_Balance, dbo.tbl_Account_Types.char_Account_Types, dbo.tbl_Account_Status.char_Current_Status FROM dbo.tbl_Accounts INNER JOIN dbo.tbl_Account_Status ON dbo.tbl_Accounts.Account_Status_ID_Number = dbo.tbl_Account_Status.Account_Status_ID_Number INNER JOIN dbo.tbl_Account_Types ON dbo.tbl_Accounts.Account_Types_ID_Number = dbo.tbl_Account_Types.Account_Types_ID_Number Here are the tables in the database tbl_Accounts ---------------- Account_ID_Number char_Account_Name date_Account_Open_Date date_Account_Closed_Date int_Account_Balance char_Account_Issuer Account_Types_ID_Number [fk] Account_Status_ID_Number [fk] tbl_Account_Types ----------------------- char_Account_Types Account_Types_ID_Number tbl_Account_Status ------------------------- Account_Status_ID_Number char_Current_Status
  4. Sure here's the error. I was checking for the invalid characters in the same text box instead of two different ones. Thanks for trying to help. ********************************* This Section Is OK ********************************* Private Sub txtAccountName_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtAccountName.Validating If IsNumeric(txtAccountName.Text) Then ErrorProvider1.SetError(txtAccountName, "Not a numeric value.") Else ' Clear the error. ErrorProvider1.SetError(txtAccountName, "") End If End Sub ******************************** Error is in this Sub ******************************** Private Sub txtIssuingBank_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtIssuingBank.Validating If IsNumeric(txtAccountName.Text) Then ErrorProvider1.SetError(txtIssuingBank, "Not a numeric value.") Else ' Clear the error. ErrorProvider1.SetError(txtIssuingBank, "") End If The code in red above should have been txtIssuingBank.text
  5. There was a logical error with the code I posted. I got the error provider to work now thanks to the help of another member.
  6. Can you use one error provider to validate multiple controls on a form. I am using one on a form that will validate the controls the first time there is an error in the first control but if the error is fixed in the first control and not fixed in the secon control the error provider goes away. Is there something wrong with the code that I have posted below. It checks two text boxes and makes sure that they contain Alpha characters and not Numeric numbers as the first character. Private Sub txtAccountName_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtAccountName.Validating If IsNumeric(txtAccountName.Text) Then ErrorProvider1.SetError(txtAccountName, "Not a numeric value.") Else ' Clear the error. ErrorProvider1.SetError(txtAccountName, "") End If End Sub Private Sub txtIssuingBank_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtIssuingBank.Validating If IsNumeric(txtAccountName.Text) Then ErrorProvider1.SetError(txtIssuingBank, "Not a numeric value.") Else ' Clear the error. ErrorProvider1.SetError(txtIssuingBank, "") End If
  7. Thanks for the reply. I ran your code but I had to make a few modifactions since I was making a GUI App and not a Console App. I have another question though. Since the timer was created in code how do I clean it up after it has completed its job. do i just set the timer to nothing. thanks again
  8. I am trying to load a form from my sub main function but the timer never fires can you tell what am i doing wrong. Thanks Public Class MainClass Friend Shared WithEvents t As New Timer() Public Shared Sub Main() Dim cl As New MainClass() t.Interval = 1 t.Enabled = True cl.LoadSplash() End Sub Public Function LoadSplash() t.Start() End Function Private Shared Sub t_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t.Tick MsgBox("Event") End Sub End Class [code] thanks
  9. I have a form that has three text boxes and one button . The user will fill in the three text boxes and then hit the button the Add the new info into the database. Here is the layout of the database. pk_Account_Id_Number <-AutoNumber char_Account_name <-User Will Supply date_Account_Open_Date <-User Will Supply int_Account_Balance <-User Will Supply I cannot figure out how to get the info from the textbox and into the database using code only. Thanks
  10. can you post the correct code I should use for the update method. Thanks
  11. I have already databinded the textboxes to the dataset. When I hit the the command button to fill the textboxes I get the first record from the database. But know I want to enter some new information into the textbox and update the database. I am new to VB.Net and would not normally use databinding but I am trying to learn everything VB.Net offers.
  12. I have two text boxes that are bound to a dataset, there is also a Sqlconnection, SqlDataadapter in use. VB.Net generated the Insert, Update and Delete statements for the dataset but I cant figure out how to get the new data out of the textboxes and into the database. This is the code that was generated by Visual Studio. Thanks for the help. 'SqlInsertCommand1 ' Me.SqlInsertCommand1.CommandText = "INSERT INTO dbo.Users(UserName, UserPassword) VALUES (@UserName, @UserPassword); " & _ "SELECT UserName, UserPassword FROM dbo.Users WHERE (UserName = @UserName)" Me.SqlInsertCommand1.Connection = Me.SqlConnection1 Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UserName", System.Data.SqlDbType.VarChar, 20, "UserName")) Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@UserPassword", System.Data.SqlDbType.VarChar, 20, "UserPassword"))
  13. Forgot the image and the VB file. Hope someone can help. Thanks form1.zip
  14. I am trying to add the icons to the menus but whenever the program tries to load the image I get the following exception. An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: 'null' is not a valid value for 'stream'. Here is the code I have so far. You can download the Magic Dll at http://www.crownwood.net/index.html The line in question has been highlighted in red. I also have included the VB file and the image. This is driving me crazy and I know its something simple. Thanks for the help Imports Crownwood.Magic.Menus Imports Crownwood.Magic.Common Imports Crownwood.Magic.Controls Public Class MDIContainer Inherits System.Windows.Forms.Form Private _count As Integer = 1 Private _images As ImageList = Nothing Private _status As StatusBar = Nothing Private _statusBarPanel As StatusBarPanel = Nothing Private _topMenu As Crownwood.Magic.Menus.MenuControl = Nothing #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() LoadResources() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call SetupMenus() SetupStatusBar() End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() ' 'MDIContainer ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(292, 266) Me.IsMdiContainer = True Me.Name = "MDIContainer" Me.Text = "Test Menu" End Sub #End Region Shared Sub Main() Application.Run(New MDIContainer()) End Sub Protected Sub LoadResources() ' Create a strip of images by loading an embedded bitmap resource [color=red] _images = ResourceHelper.LoadBitmapStrip(Me.GetType(), _ "MenuImages.bmp", _ New Size(16, 16), _ New Point(0, 0)) [/color] End Sub Protected Sub SetupMenus() ' Create the MenuControl _topMenu = New Crownwood.Magic.Menus.MenuControl() ' We want the control to handle the MDI pendant _topMenu.MdiContainer = Me ' Create the top level Menus Dim MenuFile1 As MenuCommand = New MenuCommand("&File") Dim MenuFile2 As MenuCommand = New MenuCommand("&Exit") Dim Menufile3 As MenuCommand = New MenuCommand("&Windows") Dim Menufile4 As MenuCommand = New MenuCommand("&Help") Dim Menufile8 As MenuCommand = New MenuCommand("&Wow") _topMenu.MenuCommands.AddRange(New MenuCommand() {MenuFile1, MenuFile2, Menufile3, Menufile4, Menufile8}) ' Create the submenus CreateAppearanceMenu(MenuFile1) CreateWindowsMenu(MenuFile2) CreateAnimationMenu(Menufile3) CreateCityMenus(Menufile4, Menufile8) ' Add to the display _topMenu.Dock = DockStyle.Top Controls.Add(_topMenu) ' Create an initial MDI child window OnNewWindowSelected(Nothing, EventArgs.Empty) End Sub Protected Sub CreateCityMenus(ByVal mc1 As MenuCommand, ByVal mc2 As MenuCommand) 'Define the hierarchy of the submenus Dim s0 As MenuCommand = New MenuCommand("&New York") Dim s1 As MenuCommand = New MenuCommand("N&ew Jersy") Dim s2 As MenuCommand = New MenuCommand("Ne&w Knicks") Dim s3 As MenuCommand = New MenuCommand("New &Mets") ' Setup the left column font details Dim fs As FontStyle = FontStyle.Bold mc1.MenuCommands.ExtraText = "Teams" mc1.MenuCommands.ExtraTextColor = Color.White mc1.MenuCommands.ExtraBackColor = Color.DarkBlue mc1.MenuCommands.ExtraFont = New Font("Times New Roman", 12.0F, fs) 'Draws the submenus on the screen for this function mc1.MenuCommands.AddRange(New MenuCommand() {s0, s1, s2, s3}) End Sub Protected Sub CreateAppearanceMenu(ByVal mc As MenuCommand) Dim style1 As MenuCommand = New MenuCommand("&IDE") 'Draws the submenu on the screen mc.MenuCommands.AddRange(New MenuCommand() {style1}) End Sub Protected Sub CreateWindowsMenu(ByVal mc As MenuCommand) End Sub Protected Sub CreateAnimationMenu(ByVal mc As MenuCommand) End Sub Protected Sub SetupStatusBar() ' Create and setup the StatusBar object _status = New StatusBar() _status.Dock = DockStyle.Bottom _status.ShowPanels = True ' Create and setup a single panel for the StatusBar _statusBarPanel = New StatusBarPanel() _statusBarPanel.AutoSize = StatusBarPanelAutoSize.Spring _status.Panels.Add(_statusBarPanel) Controls.Add(_status) End Sub Public Sub SetStatusBarText(ByVal text As String) _statusBarPanel.Text = text End Sub Protected Sub OnNewWindowSelected(ByVal sender As Object, ByVal e As EventArgs) Dim child As MDIChild = New MDIChild(Me) child.MdiParent = Me child.Size = New Size(130, 130) child.Text = "Child" & _count child.Show() _count += 1 OnMenuItemSelected("NewWindow") End Sub Protected Sub OnMenuItemSelected(ByVal name As String) Dim child As MDIChild = Me.ActiveMdiChild If Not (child Is Nothing) Then child.AppendText(name) End If End Sub End Class Public Class MDIChild Inherits Form Protected _mdiContainer As MDIContainer Protected _box As RichTextBox Sub New(ByVal mdiContainer As MDIContainer) ' Remember parent Form _mdiContainer = mdiContainer ' Create a RichTextBox to fill entire client area _box = New RichTextBox() _box.Text = "Right click inside this window to show a Popup menu." _box.Dock = DockStyle.Fill _box.BorderStyle = BorderStyle.None AddHandler _box.MouseUp, AddressOf OnRichTextMouseUp Controls.Add(_box) End Sub Public Sub AppendText(ByVal text As String) _box.Text = _box.Text & vbCrLf & text End Sub Protected Sub OnRichTextMouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) 'If e.Button = MouseButtons.Right Then ' Dim box As RichTextBox = sender End Sub Protected Sub OnSelected(ByVal mc As MenuCommand) _mdiContainer.SetStatusBarText("Selection over " & mc.Description) End Sub Protected Sub OnDeselected(ByVal mc As MenuCommand) _mdiContainer.SetStatusBarText("") End Sub End class
×
×
  • Create New...