oussama_1 39 Posting Whiz in Training

VB.Net never meant for games! it's more recommended for software developement, but hey why not have some fun.
If anyone out there is looking to create an Angry Birds Game-like or a Simulator for throwing an object, you've come to the right place, this code will give you great start/push to build your own app.

Trajectory

dd5f632319f6a4422579ce0a7c3db41e

A Trajectory for a projectile have a bunch of formulas, the more equations you use, the more realistic motion you'll get.
As a start i used only 3 formulas which they're the essentiel ones,the X and Y coordinates and the angle, containing the gravity and the velocity with the respect to time.
Have fun!

ScreenShot:

7e1985143cfac0fb9ff793ae9e0a1476

J.C. SolvoTerra commented: Very Cool, I love this stuff. +3
oussama_1 39 Posting Whiz in Training

In my opinion there is no easy language! let me put it this way, in every language there is a basic , intermediate and advanced level, you always start easy and then you build your way up. Besides your choice highly depends on what do you want to do (ex: software/web/game/etc.) and on which platform?

oussama_1 39 Posting Whiz in Training

Use a backgroundworker, Click Here

J.C. SolvoTerra commented: Probably the most accurate supply on demand I've ever witnessed hahaha +3
oussama_1 39 Posting Whiz in Training

"the other way around":

 for(int i=1; i<=loop; i++){
System.out.println("Enter a number: ");
number = input.nextInt();

if(i==1){
maxValue = number;
minValue = number;
}
else{
if (number > maxValue) {
maxValue = number;
}
if (number < minValue){
minValue = number;
}}}

Good luck

oussama_1 39 Posting Whiz in Training

for seconds you need the remainder:

int seconds = second%60;
Gl753 commented: Ah jeez I'm slipping, I knew it was only something small it was missing :) Thank you +0
oussama_1 39 Posting Whiz in Training

Same here, i use My.Settings.

oussama_1 39 Posting Whiz in Training

Your strUserInput should be a string, so:

Dim strUserInput As String
oussama_1 39 Posting Whiz in Training

ok this is what i came up with for now..should work though

        Dim cmd2 As New System.Data.OleDb.OleDbDataAdapter()
        cmd2 = New System.Data.OleDb.OleDbDataAdapter("select * from [" + Label11.Text + "] ", cn)
        Dim DtSet As System.Data.DataSet
        DtSet = New System.Data.DataSet
        cmd2.Fill(DtSet)
        For i As Integer = 0 To DtSet.Tables(0).Rows.Count - 2
            '' i'm guessing that your EmpID is your first column in your database
            If DtSet.Tables(0).Rows(i).Item(0).ToString = Login.txtEmpID.Text Then
                Button1.Enabled = False
            End If
        Next
oussama_1 39 Posting Whiz in Training

There's a short way to do it, change button1_click to this:

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Try
            Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\pant.16\Desktop\Projects\Microsoft - MSV\Microsoft - MSV\bin\Debug\MSVDB.accdb")
            If cn.State = ConnectionState.Open Then
                cn.Close()
            End If
            cn.Open()
            ''
            ''____________________________________________
            ''
            If MsgBox("Confirm Submit?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question) = MsgBoxResult.Yes Then
                ' of course label11 should be your table name in the access file
                ' the command is like this: (insert into Mytable (columnName1,columnName2) values (MyInput1,MyInput2), cn)
                Dim cmd1 As New OleDb.OleDbCommand("INSERT INTO [" + Label11.Text + "](EmpID,Answer1,Answer2,Answer3,Answer4,Answer5,Answer6,Answer7,Answer8,Answer9,Answer10) values('" & Login.txtEmpID.Text & "','" & ComboBox1.Text & "','" & ComboBox2.Text & "','" & ComboBox3.Text & "','" & ComboBox4.Text & "','" & ComboBox5.Text & "','" & ComboBox6.Text & "','" & ComboBox7.Text & "','" & ComboBox8.Text & "','" & ComboBox9.Text & "','" & ComboBox10.Text & "')", cn)
                cmd1.ExecuteNonQuery()
        Catch ex As Exception
            MsgBox(ex.Message(), MsgBoxStyle.Critical, "Error")
            Exit Sub
        End Try
    End Sub

Good luck

oussama_1 39 Posting Whiz in Training

They are all good, but from experience i recommend maya, it's great software just create your models and drop them in unity. and btw unity 3d have a lot of features that already exist in maya and 3d max.

oussama_1 39 Posting Whiz in Training

@stultuske Logically the sum here is a variable, for ex: Sum of the Addition of 1 2 3 4 is 10

@OMDYD Try this

String output="Sum of the Addition of "+num1+" "+num2+" "+num3+" "+num4+" is "+Sum;
oussama_1 39 Posting Whiz in Training

Try this:

if Not YourConnection.state = ConnectionState.Open Then
'promot user
end if
oussama_1 39 Posting Whiz in Training

@ddanbe
It's impossible that this code adds an extra hours other than one hour to the current time (meaning whatever time it is, it'll only add only one hour to it), and i recommended the timer tick event other than ValueChanged event for one important thing, that is he want to show the seconds in the control
so the control needs to change every second to display a proper time.
i'm sorry i didn't clear that out in my first post.

the date in the format of h:mm:ss tt

ddanbe commented: Good point. +15
oussama_1 39 Posting Whiz in Training

Ok i get it now.

public static int[][] Puzzle(int[] numbers, int x) {

    int rows = 0,a = 0;
    for (int i = 0; i<numbers.length;i++){
           for (int j = 1;j>=i && j<numbers.length;j++){
               if (numbers[i] +numbers[j]==x){
               if (i!=j){
                   rows++;
               }}
    }} 

    int [][]b = new int [rows][2];
    for (int i = 0; i<numbers.length;i++){
           for (int j = 1;j>=i && j<numbers.length;j++){
                   if(numbers[i]+numbers[j] == x){
                                    if (i!=j){
                        b[a][0] = i;
                        b[a][1] = j;
                        a++;
                    }}
    }
    }return b; 
    }
}

Copy/paste the whole thing, and you are good to go.

oussama_1 39 Posting Whiz in Training

Use Control.Parent = Panelx
example : button1.parent = panel1
the button1 is now attached to panel1, so that when you hide or move the panel the control in it(button1) will behave the same.

oussama_1 39 Posting Whiz in Training

You need to return all possible combinations, so you need a method that returns a multidimensional array. Ok let's start with the main method; we will create a sample array with the list and then the 2D array that calls the method:

    public static void main(String[] args) {
      int a[] = {1,2,3,4,5,6,7},b[][] = Puzzle(a, 10);

      // display results:
      for(int i = 0; i < b.length; i++){
      for(int j = 0; j < b[i].length; j++){
        System.out.print(b[i][j]+" ");}
    System.out.println();}
    }    

The puzzle method; since we don't know how many rows are going to be in the 2D array i'm going to use the same loop(of checking out the combinations) to determine the number of rows:

public static int[][] Puzzle(int[] numbers, int x) {
    //Check rows number:
    int rows = 0,a = 0;
    for (int i = 0; i<numbers.length;i++){
           for (int j = i; j<numbers.length;j++){
               if (numbers[i] +numbers[j]==x){
                   rows++;
               }
    }} 

    //Check for combinations:
    int [][]b = new int [rows][2];
    for (int i = 0; i<numbers.length;i++){
           for (int j = i; j<numbers.length;j++){
               if (numbers[i] +numbers[j]==x){
                b[a][0] = numbers[i];
                b[a][1] = numbers[j];
                a++;
    }} 
    }return b; 

Good Luck.

oussama_1 39 Posting Whiz in Training

Yes, you can improve it:

int [][] arrayOfSets = new int[5][5];

and that's it, an array of type int will have a 0 in each cell by default.

oussama_1 39 Posting Whiz in Training

2a021e2ac28430cdd62d76dd91d72191

336f09d717b7e93e3ca7c82915e133dc

This post has no text-based content.
oussama_1 39 Posting Whiz in Training

Since your printer is on a network and inaccessible through ports you are left with one option, you should target the ip address of that printer so don't use a serialport because you can't assign a printer's ip as a portname.
I highly recommend you to read the link cgeier gave, your answer is there.
gd luck.

oussama_1 39 Posting Whiz in Training
  • Ok Change line 21 to

    double fixedSalary = 100000;

Reason: Type of variable not declared also a syntax error, you can't add any character such as "," in type int, double or float and it's unnecessary.

  • line 23

    double commission;

Reason: since it's a fraction number (2.5) you should use type double or float

  • delete line 25,26 and 27
    Reason: logic + syntax error, if you notice you repeating the same code twice so delete the above code because you didn't declared its variables

  • line 36

    commissionCalc = totalSales * (commission/10);

Reason: logic error, you didn't use the commission, it's a waste of memory, so make use of it.

  • lines 38 and 39

    System.out.println("The total sales of the salesperson is $"
    + commissionCalc + " using a 2.5% commission.");

Reason: syntax error, missing quote.

  • in line 42 change commisionCalc to commissionCalc and totalFixedSum to totalfixedsum also in line 44
    Reason: Java is case sensitive, you should match what you wrote at first.

and that's it you are good to go.

oussama_1 39 Posting Whiz in Training

Here's Some of my habits that i picked up over the years, How about you?
- Refresh every 5min
- my fingers are on "A", "W" and "D" keys
- bite my nails while coding
- i had a fan problem once, and after fixing it i kept my habit of checking the task manager every now and then.

oussama_1 39 Posting Whiz in Training

Have you noticed this pattern in every episode of any tv show
- Previously on..
- New issue/new villain
- Series introduction (short video)
- Commercials
- Things are getting worse
- Commercials
- The hero have no chance what so ever of saving the day
- Commercials
- The hero saves the day
- Commercials
- But wait there's more/Everybody is happy/New dilemma
- glimpses of what will happen on the next episode
- Credits

oussama_1 39 Posting Whiz in Training

Try the publish way, because in this way you can add everything your program needs to operate to the installer, in these 2 buttons
8943da1c1cad7e22c29ad3d27d185452

oussama_1 39 Posting Whiz in Training

Check your Active solution platform if it is compatible with your System type (e.g. 64-bit)

oussama_1 39 Posting Whiz in Training

Use Form.ActiveForm

'close button
Form.ActiveForm.Close()
'maximize button
Form.ActiveForm.WindowState = FormWindowState.Maximized
'minimize button
Form.ActiveForm.WindowState = FormWindowState.Minimized
oussama_1 39 Posting Whiz in Training

Here's a simple game code, open a new vb project and copy paste this code and hit run.
the game contains 3 levels, all you have to do is to shoot the smiley faces to earn money using mouse clicks, also there's a boss enemy on level 3.
I didn't have much time to add more levels to the game (actually i only tried to play it once :p), here's my point of this code "Just for fun" try to import some enemy characters(in a picturebox) and add more levels and add some sound effects to the shooting or when the enemies get hurt or whatever you would like to do.

Begginnerdev commented: Not bad! +9
oussama_1 39 Posting Whiz in Training

both and change the style, i think "Continuous" is what you are looking for

oussama_1 39 Posting Whiz in Training
    Private Sub Button7_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button7.Click
        'set your timer to minutes
        Timer2.Interval = 60000
        'set you progressbar max value to 45
        ProgressBar1.Maximum = 45
        Timer2.Start()
        Button7.Enabled = True
        Label8.Text = "Match Begins"
    End Sub

    Private Sub Timer2_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer2.Tick
        ProgressBar1.Increment(1)
        If ProgressBar1.Value = 1 Then
            Label8.Text = "1st Half"
        End If
        If ProgressBar1.Value = 45 Then
            Label8.Text = "Half-Time"
        End If
    End Sub
oussama_1 39 Posting Whiz in Training

Dim textbox As New ArrayList

oussama_1 39 Posting Whiz in Training

wow buddy your code doesn't make any sense.
you should run this once

    With dgv_booklist
        .Columns.Add("ISBN", "ISBN")
        .Columns.Add("BookCode", "BookCode")
        .Columns.Add("Title", "Title")
        .Columns.Add("Author", "Author")
        .Columns.Add("Category", "Category")
        .Columns.Add("StudentNo", "StudentNo")
        .Columns.Add("FirstName", "FirstName")
        .Columns.Add("LastName", "LastName")
        .Columns.Add("BorrowDate", "BorrowDate")
        .Columns.Add("LoanPeriod", "LoanPeriod")
    End With

and that's the add row code

Private Sub btn_addborrow_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_addborrow.Click
    dgv_booklist.Rows.Add(txtbox_isbn.Text, txtbox_code.Text, txtbox_title.Text, txtbox_author.Text, txtbox_category.Text, txtbox_studno.Text, txtbox_firstname.Text, txtbox_lastname.Text, dtp_borrowdate.Text, txtbox_loanperiod.Text)
End Sub
oussama_1 39 Posting Whiz in Training

in a button click event create 2 different connection(oleDb.oleDbConnection) like this

Dim Connection1 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source='" & "Access 1 Full Path" & "';" & "Persist Security Info=False;" & "Jet OLEDB:Database Password=" & "your pass" & ";")



Dim Connection2 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source='" & "Access 2 Full Path" & "';" & "Persist Security Info=False;" & "Jet OLEDB:Database Password=" & "your pass" & ";")

and of course different command for each table

        Dim cmd As OleDbCommand
        Dim dr As OleDbDataReader
        Try
            Connection1.Open()
            cmd = New OleDbCommand("SELECT *  from TableNameOfFirstAccess WHERE ID=" & ID.Text & "", Connection1)
            dr = cmd.ExecuteReader
            If dr.Read Then
                ID.Text = dr("ID")
                Age.Text = dr("Age")
                Sex.Text = dr("Sex")
                Name.Text = dr("Name")
            Else
                MsgBox("No Such Account")
            End If
        Catch
        End Try
        dr.Close()
        Connection1.Close()

        Try
            Connection2.Open()
            cmd = New OleDbCommand("SELECT *  from TableNameOfSecondAccess WHERE ID=" & ID.Text & "", Connection2)
            dr = cmd.ExecuteReader
            If dr.Read Then
                form2.Hb.Text = dr("Hb")
            Else
                MsgBox("No Such Account")
            End If
        Catch
        End Try
        dr.Close()
        Connection2.Close()
oussama_1 39 Posting Whiz in Training

Please tell me the code.

Dear Satyam_1
What you are asking is for us to work for you instead of helping you, you see programmers get paid for these codes! Programmers spend a lot of money and years of their time studiyng these codes,don't take this the wrong way at least just show some effort (any kind of effort) so we can help you in our free time. Click Here
Good Luck

oussama_1 39 Posting Whiz in Training

like this ?

datagridview.rows(index).cells(index).value = dr.item("ID")
oussama_1 39 Posting Whiz in Training

set timer to minutes : timer.Interval = 60000
on button click event put timer.start
in timer1_tick event each tick is a 1 minute so count the minutes
count = count + 1 and if count == 2 then alert and stop timer (timer.stop).
good luck

oussama_1 39 Posting Whiz in Training

Add your txt file to your app resources
Project - Project properties - resources - upload

oussama_1 39 Posting Whiz in Training

how about thread.sleep(TIME)

oussama_1 39 Posting Whiz in Training

you should chnage the statment(Oledb command) like "DELETE FROM table WHERE Name =" & TxtName.Text & "" and other few modifications but this is a different question, there's a lot of free tutorials on this,try it on your own if you get any errors then post it.
if this question is solved then mark it as such
good luck.

oussama_1 39 Posting Whiz in Training

nowhere, that's the whole code.

Label.text.replace("dis", "")
oussama_1 39 Posting Whiz in Training

Step1

TextBox1.Text = sender.text & ","

Step2

TextBox1.Text = TextBox1.Text & sender.text

Step3

        Dim qty As String = TextBox1.Text.Substring(0, TextBox1.Text.ToString.LastIndexOf(","))
        Dim itemName As String = TextBox1.Text.Replace(qty & ",", "")
        DataGrid.Rows.Add(itemName, "", "", qty)

Step4

Label.Text = DataGrid.Rows(index).Cells(index).Value
oussama_1 39 Posting Whiz in Training
        'add yourTableName
        Dim insertCommand As New OleDb.OleDbCommand("INSERT INTO yourTableName (Bank, Acno, Name) VALUES ('" & TxtBank.Text & "','" & TxtAcno.Text & "','" & TxtName.Text & "')", CN)
        Try
            CN.Open()
            insertCommand.ExecuteNonQuery()
            MsgBox("Record Added Successfully")
        Catch ex As Exception
        Finally
            CN.Close()
        End Try
oussama_1 39 Posting Whiz in Training

ok here's the code

        Dim cmd As OleDbCommand
        Dim dr As OleDbDataReader
        Try
            CN.Open()
            cmd = New OleDbCommand("SELECT *  from Receipts WHERE Bank='" & TxtBank.Text & "'" & "AND Acno='" & TxtAcno.Text & "'", CN)
            dr = cmd.ExecuteReader
            If dr.Read Then
                TxtName.Text = dr("Name")
                TxtName.Focus()
            Else
                MsgBox("No Such Account")
            End If
        Catch
        End Try
        dr.Close()
        cn.Close()
oussama_1 39 Posting Whiz in Training
            dAdapter.Fill(ds);
            dataGridView1.DataSource = ds.tables(0);
oussama_1 39 Posting Whiz in Training

c93cf2cca6488324256a29d11d3292f9

when the user add a file,compress that file into a zip file and store it into a protected folder. and create a fake image of that file in your listview and store the directory info for each file in your app for later use..such as extracting.

1) how to zip files (extract,move)
2) how to protect a folder

1) reference the System.IO.Compression.FileSystem form /Windows/Microsoft.NET/assembly/GAC_MSIL/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem.dll

Imports System.IO
Imports System.IO.Compression

Module Module1

    Sub Main()
        Dim startPath As String = "c:\example\start" 
        Dim zipPath As String = "c:\example\result.zip" 
        Dim extractPath As String = "c:\example\extract"

        ZipFile.CreateFromDirectory(startPath, zipPath)

        ZipFile.ExtractToDirectory(zipPath, extractPath)
    End Sub 

End Module

reference : ZipFile Class

2) Protect Folder

Imports System.Security.AccessControl
Imports System.IO

Remove access from folder

Dim FilePath As String = "The Folder you want to protect"
        Dim fs As FileSystemSecurity = File.GetAccessControl(FilePath)
        ' Please Change User if needed (C:\Users\"USER")
        fs.AddAccessRule(New FileSystemAccessRule("User", FileSystemRights.FullControl, AccessControlType.Deny))
        File.SetAccessControl(FilePath, fs)

Add access to folder

Dim FilePath As String = "The Folder you want to protect"
        Dim fs As FileSystemSecurity = File.GetAccessControl(FilePath)
        ' Please Change User if needed (C:\Users\"USER")
        fs.RemoveAccessRule(New FileSystemAccessRule("User", FileSystemRights.FullControl, AccessControlType.Deny))
        File.SetAccessControl(FilePath, fs)

Gd Luck

oussama_1 39 Posting Whiz in Training
       For i = 0 To 2
            Dim RadioButton As RadioButton = CType(Me.Controls("RadioButton" & i + 1), RadioButton)
            If RadioButton.Checked = True Then
                MsgBox("Food :" & RadioButton.Text & ", Quantity :" & txtCountFood)  'msgbox is example
            End If
        Next
oussama_1 39 Posting Whiz in Training

here's the copy raw solution
ill post the database update later

    Private Sub DataGridView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseClick
        If DataGridView1.RowCount = 0 Or Nothing Then
        Else
            For Each cell As DataGridViewColumn In DataGridView1.Columns
                DataGridView2.Columns.Add(DirectCast(cell.Clone, DataGridViewColumn))
            Next
            DataGridView2.Rows.Add(DataGridView1.CurrentRow.Cells.Cast(Of DataGridViewCell).Select(Function(c) c.Value).ToArray)
        End If
    End Sub
oussama_1 39 Posting Whiz in Training

go to your form properties go to misc and set keypreview to true and set your acceptbutton

oussama_1 39 Posting Whiz in Training

no that's not right..it all depends on the software you are working on
unity software comes with a customized software called MonoDevelop for debugging scripts which accepts these three languages.
here's a photo of unity and the script language you can create

e14eb8adb5d8b31b8104e12aad041d6a

and here's the "End-user license agreement" for unity
gd luck

oussama_1 39 Posting Whiz in Training

Sorry, Didnt get the question
try this

  Dim ofd As New OpenFileDialog
        Dim strFile As String
        With ofd
            .Title = "Select a List"
            .Filter = "Text Files|*.txt|All Files|*.*"
            .ShowDialog()
            strFile = .FileName
        End With
        RichTextBox1.LoadFile(strFile, RichTextBoxStreamType.PlainText)
        For Each line In RichTextBox1.Lines
            If line.StartsWith("A") Then
                If line.EndsWith("0") Then
                    Dim newline As String
                    newline = line.Substring(0, line.Length - 1) & "Replace with this"
                    RichTextBox1.Text = RichTextBox1.Text.Replace(line, newline)
                End If
            End If
        Next
AnooooPower commented: this works thanks oussama +0
oussama_1 39 Posting Whiz in Training
        Dim ofd As New OpenFileDialog
        Dim strFile As String
        With ofd
            .Title = "Select a List"
            .Filter = "Text Files|*.txt|All Files|*.*"
            .ShowDialog()
            strFile = .FileName
        End With
        RichTextBox1.LoadFile(strFile, RichTextBoxStreamType.PlainText)
        For Each line In RichTextBox1.Lines
            If line.StartsWith("A") Then
                If line.EndsWith("0") Then
                    RichTextBox1.Text = RichTextBox1.Text.Replace(line, line.Replace("0", "Replace with this"))
                End If
            End If
        Next
oussama_1 39 Posting Whiz in Training

hmm dont know about that...actually if you use a datagridview itll be less coding for you other than that u gonna have to code everything
gd luck