Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
K

kyosugi

@kyosugi
About
Posts
9
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Arraylist
    K kyosugi

    I am doing a micro video application and am experiencing problems with my arraylist. I have 2 separate frame. One is ListGameFrame and the other ListVideoFrame. When I add new games to the ListGameFrame and selects the ListGame option to view, I will also see my items from the videos section. This is my coding for the ListGameFrame for adding games.

    public void addGamesToList(ArrayList<Item> items)
    {
    // Clear any existing rows from the table
    this.clearDataFromTable();

        // For each game in the arraylist, add a row to table
        for (Item i : items)
        {
            String GameID = i.getItemId();
            String GameName = i.getTitle();
    
    
            String\[\] rowData = {GameID,GameName};
            ((DefaultTableModel)tblGames.getModel()).addRow(rowData);
        }
    }
    

    And this my coding for viewing the list of games via a class call VideoManager.

    private static void readGameObjects()
    {
    // Create an ObjectInputStream to read data (from game file)
    ObjectInputStream in = openObjectInputFile(gameFileName);
    if (in == null) // Nothing to read
    return;

        try {
            Item i = (Item)in.readObject();
    
            // While there are game objects to read...
            while (i != null)
            {
                // Add object to game arraylist
                items.add(i);
                i = (Item)in.readObject();
            }
        } catch (EOFException e) {} // Do nothing if EOF reached
        catch (IOException e)
        {
            System.out.println(e.getMessage());
            e.printStackTrace();
            System.out.println("Error in reading customer file");
    
        } catch (ClassNotFoundException e)
        {
            System.out.println(e.getMessage());
            e.printStackTrace();
            System.out.println("Error in file format: Customer file");
        } finally
        {
            try {
                    // Close the file
                    in.close();
            } catch (IOException e)
            {
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
        }
    }
    

    Sorry for the long codes as I do not know how to simplfy the problem I am facing now. May I know if there is any specific problems in my coding which results the game list to also show the video list?

    Java help game-dev sales tutorial question

  • displaying info from database [urgent pls help]
    K kyosugi

    1st, i check for a valid id for the user n if its valid, a new form will show the new form contains textboxes and a combo box i would wan the textboxes and the combo box to display the corresponding stuff from the database for exmaple name: my name address : my address the followin is the code i used -------- this 1 is which i validate the id, it works, but jus in case i wana know if the other code did not work because of it -------- Private Sub submitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitB.Click Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\My Documents\project\db1.mdb" Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand Try Dim strselect As String = "Select BorrowerId from member where BorrowerId = '" & idTB.Text & "'" 'create a new connection con = New OleDb.OleDbConnection(strcon) con.Open() cmd.Connection = con cmd.CommandText = strselect dr = cmd.ExecuteReader If dr.Read Then If idTB.Text = dr("BorrowerId") Then MessageBox.Show("Valid Id") EditMember.Show() End If Else MessageBox.Show("Invalid Id") End If If idTB.Text = "" Then MessageBox.Show("Please Enter The BorrowerID") End If dr.Close() Catch eException As Exception MessageBox.Show(eException.Message) End Try End Sub -------- this 1 is where i wan the info to display out on the textboxes n combo box -------- Private Sub EditMember_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source =C:\Documents and Settings\Jasmine\My Documents\project\db1.mdb" Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim cmd As New OleDb.OleDbCommand Try Dim strselect As String = "Select Fname, Lname, Address1, Address2, Address3, ContactNo, HandPhNo, Email, CourseOfStudy from member where BorrowerId = '" & EditMemberLog.idTB.Text & "'" 'create a new connection con = New OleDb.OleDbConnection(strcon) con.Open()

    Visual Basic database help

  • insert syntax problem, pls help....
    K kyosugi

    opps, thx mus haf posted help at too many forums, missed out, haha

    Visual Basic database help debugging tutorial question

  • insert syntax problem, pls help....
    K kyosugi

    posted b4 but i cant seem to find the old thread n i need help urgently >.< tis is the code i tried to use --------- Private Sub AddSubmitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddSubmitB.Click Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\db.mdb" Dim cmd As New OleDb.OleDbCommand Dim con As OleDb.OleDbConnection Dim strsql As String con = New OleDb.OleDbConnection(strcon) con.Open() strsql = "Insert into member (BorrowerId, password, MemberType, Fname, Lname, Gender, Address1, Address2, Address3, ContactNo, HandPhNo, Email, CourseOfStudy, EnrolledDate, ExpiryDate) values ('" & StudIdTB.Text & "','" & StudPwTB.Text & "','" & UgTB.Text & "','" & StudFnTB.Text & "','" & StudLnTB.Text & "','" & StudGenderCLB.Text & "','" & StudAdd1TB.Text & "','" & StudAdd2TB.Text & "','" & StudAdd3TB.Text & "','" & StudHmTB.Text & "','" & StudHpTB.Text & "','" & StudMailTB.Text & "','" & CosCB.Text & "','" & EnrolledCB.Text & "','" & ExpiryCB.Text & "')" cmd.Connection = con cmd.CommandText = strsql cmd.ExecuteNonQuery() con.Close() MsgBox("New Member Added!") Me.Close() End Sub --------- when i tested it today, it did not work the debugger stopped at cmd.ExecuteNonQuery it says OleDbException was unhandled Syntax error in INSERT INTO statement. i checked thru my database and the sql statements n r fine, oso tried adding square brackets how to solve?

    Visual Basic database help debugging tutorial question

  • To make characters in the text of TextBox ReadOnly.
    K kyosugi

    my 1 i used the property table of the textbox scroll and go find the read-only option n set it to true

    Visual Basic csharp question

  • insert error
    K kyosugi

    i trying to add info from user input n submit into the database i use the insert into -------------- Private Sub AddSubmitB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddSubmitB.Click Dim strcon As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Jasmine\My Documents\member\db1.mdb" Dim cmd As New OleDb.OleDbCommand Dim con As OleDb.OleDbConnection Dim dr As OleDb.OleDbDataReader Dim strsql As String con = New OleDb.OleDbConnection(strcon) con.Open() strsql = "Insert into member(BorrowerId, Fname, Lname, Gender, Address1, Address2, Address3) values('" & BorrowerIdTB.Text & "',' " & FnameTB.Text & "',' " & LnameTB.Text & "','" & GenderCLB.Text & "',' " & Add1TB.Text & "','" & Add2TB.Text & "',' " & Add3TB.Text & "')" cmd.Connection = con cmd.CommandText = strsql cmd.ExecuteNonQuery() con.Close() MsgBox("Record Added") Me.Close() End Sub -------------- when i run it the debugger stopped at cmd.ExecuteNonQuery() i seriously duno wat the error is about

    Visual Basic database debugging help

  • add
    K kyosugi

    ok, thx a lot

    Visual Basic question database regex help

  • add
    K kyosugi

    thx for the links ^^ tried them out n still tryin to understand kinda got a prob since i'm using vb 2005 express edition and cant open the source files to take a look at the examples noe where can i get examples for using vb software? sry fer da trouble. been looking but cant find yet. saw da ultimate grid ad at the side n kinda looking into it.

    Visual Basic question database regex help

  • add
    K kyosugi

    new here and need some help i did not learn vb but i need to code a project wif vb @_@ i set a button to start the validation of a textbox input of something to match a field from database, did a If and else for different situations when user input nothing or invalid stuff. so, after that how do i retrieve the data from the database and display the info in textbox in the windows form? i also need help in using datagrid to connect to a database which i have and display the information from the database thx a bunch n i need them err....asap if possible since i only haf 2 weeks to begin wif @_@ thx alot

    Visual Basic question database regex help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups