oussama_1 39 Posting Whiz in Training

First of all, DateTimePicker have nothing to do with DateTime they are two seperate things.
Second, the problem is in your method,you see you have a method(deliveryTime_ValueChanged) and when this method is called or triggered it'll run the code inside of it (deliveryTime.MinDate = DateTime.Now.AddHours(1);) and the problem is that there's nothing to trigger your method which is changing the date of your dateTimePicker, it's like you want to see what's inside of a potato chips bag without opening the bag.
i recommend that you use a timer tick event like so:

private void timer1_Tick(object sender, EventArgs e)
{
   deliveryTime.Mindate = DateTime.Now.AddHours(1);
}

add a timer control and you can call it by Timer1.enabled = true;

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

In the picture; line 7 change it to:

for (int j = 1;j>i && j<numbers.length;j++){
oussama_1 39 Posting Whiz in Training

Make sure it's the same code i posted, because there's no way you'll get a {0,0} in the output, or send me your final code and i'll take a look at it

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

Ok in the inner loop, [j] should always be a one step ahead of [i]:

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){
                   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){
                        b[a][0] = i;
                        b[a][1] = j;
                        a++;
                    }
    }
    }return b; 
    }
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

What did you write in the cmd?

oussama_1 39 Posting Whiz in Training

Welcome :)

oussama_1 39 Posting Whiz in Training

goal

oussama_1 39 Posting Whiz in Training

Perfume: The Story of a Murderer. beautiful story

oussama_1 39 Posting Whiz in Training

Granted: surprise surprise, it says in the contract "Gogle" and you didn't notice, you my friend just bought a small plumber company in mexico.. congratulation

I wish to be a mentalist

oussama_1 39 Posting Whiz in Training

2a021e2ac28430cdd62d76dd91d72191

336f09d717b7e93e3ca7c82915e133dc

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

boat

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 so you are assuming it's COM9, to be sure add this code and tell me what happens

dim List As New ListBox
List.items.addRange(IO.Ports.SerialPort.GetPortNames)
for each item In List.Items
msgBox(item)
next
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

Btw what is your portname in runtime? (msgbox(portname))

oussama_1 39 Posting Whiz in Training

Are you sure it's connected through "COM9"? (devices and printers >> printer properties >> ports), if yes then add this code before opening the serial port

PrinterSerial.DtrEnable = True
PrinterSerial.RtsEnable = True

Reference : Click Here

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

fête de la musique.

What is your favorite password?

oussama_1 39 Posting Whiz in Training

"Yippee-ki-yay, motherf&$)#*."
Bruce Willis

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

I have a beard (you can see it in my profile pic), for about 8 years.. i'm 26 now and i don't consider myself as a hairy guy, i mean i can barely see the hair on my chest and for that i can't get my beard to grow big and thick (and fine looking) like some of the members here, also here's the problem i can't shave it completely because i would look like a 16 yo kid :( i guess this is what a baby-face adults suffer from (like myself).
cheers

oussama_1 39 Posting Whiz in Training

@Mr.M Ok the full code is in the attached text file. what i did is that i added the above code(randomize) to line 207.
but i have to warn you, i gets pretty hard on level 2 :D

oussama_1 39 Posting Whiz in Training

Line 302 has: control.text = String.Concat("Level ", levelNum.ToString, " Lives ", lives.ToString, " Money: ", rewards.ToString) This would do the same thing in a shorter format: control.text = String.Format("Level {0} Lives {1} Money: {2}", levelNum, lives, rewards)

Yes you are right, and there's a lot of other ways to do it, but as long as it doesn't affect the performance or say the memory then there's no need to change it.

@ Mr.M

I have a suggestion...

This is a very simple code, i didn't use the math class or physics or any engine. As for your suggestion, i like the idea, you can add a level in the levels method and call it later, read through the code and you can figure it out easily (i know it a lot to read :D), but here's a sample on changing the position randomly on level 2 try it
add this to Private Sub Timer_Tick(ByVal sender As Object, ByVal e As EventArgs)

        If levelNum = 2 Then
            Dim Rand = New Random()
            Dim Pos = Rand.Next(-50, 51)
            Dim Smiley = Rand.Next(i + 1)
            If Not IsNothing(Me.Controls("enemy" + Smiley.ToString)) Then
                If Not Me.Controls("enemy" + Smiley.ToString).Location.X + Pos > 250 Then
                    If Not Me.Controls("enemy" + Smiley.ToString).Location.X + Pos < 20 Then
                        Me.Controls("enemy" + Smiley.ToString).Location = New Point(Me.Controls("enemy" + Smiley.ToString).Location.X + Pos, Me.Controls("enemy" + Smiley.ToString).Location.Y)
                        Me.Controls("blood" + Smiley.ToString).Location = New Point(Me.Controls("blood" + Smiley.ToString).Location.X + Pos, Me.Controls("blood" + Smiley.ToString).Location.Y)
                    End If
                End If
            End If

        End If
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

Just to be clear, did you go through these steps?
your project properties >> publish >> installer path >> publish now >> run setup.

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

Thanks

oussama_1 39 Posting Whiz in Training

Hi guys, i was told that with the right settings of Qos in my router, i can prioritize the internet speed between online gaming or watching videos or browsing etc.. but what i want is to give a high priority to my pc among other pc's connected to my router.
So what do i fill in the blanks?

9e4a6f2513cbdc5506b849f6e2d7323b

a88fa4e1bc38f7904a6684946ab07922

Thanks.

oussama_1 39 Posting Whiz in Training

Please post the new code.

oussama_1 39 Posting Whiz in Training

Create your database >> connect your device >> open serialport >> read data >> store data.
usually there's a manual accompanied with this device and i'm sure there's developer section in it, check it.

oussama_1 39 Posting Whiz in Training

Replace

while (end = false)

With

while (end == false)

Or

while (!end)
oussama_1 39 Posting Whiz in Training

Your "errors" are both logical errors and syntax errors
Syntax errors:
-when you write a method, you can't use the semicolon, just open the curly braces then write your code then close it.
-in your main method it's a "String" instead of "Strings"
-as JamesCherrill said, indent your code, so you can read it properly and faster.
Logic error:
-Since your variables are declared in a way that all your class methods can access it, you don't need to pass the variable when you call your method.
this would be enough for you worldCine();

Now consider my notes then rewrite your code and post it here so that i or other members can help you more.

oussama_1 39 Posting Whiz in Training

Thank you for your notes.

As a game concept:
i didn't work that much on that part but still everything is editable
(variables, level etc..) and yes you are right i should remove the
upgrade button when the second round starts :D.

As for the bug
now let's talk coding, the upgrade button should be clicked once
(money issue resolved) and then disposed by the clear methode

 Private Sub clear(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
For XX = 0 To 10
On Error Resume Next
Me.Controls("BtnNote").Dispose()
Next
End Sub

yet for some reason i cant dispose this button as easily, that's why i
put a loop on the dispose part because at the first couple times it
will throw this error "object is not set to an instance of a object"
(i handled it by on error resume next) it's like the control "BtnNote"
never existed! But eventually it'll get disposed(according to my run
test), but not according to you..so damn :p i thought i did handle
this bug :D.
again thanks for your notes.

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

Create a fullscreen black form with low opacity and make it on top most then display your dialog above it.

oussama_1 39 Posting Whiz in Training

Use this code twice

My.Computer.Audio.Play(audio path, AudioPlayMode.WaitToComplete)
oussama_1 39 Posting Whiz in Training

Try to put this code in between

System.Threading.Thread.Sleep(Time)
oussama_1 39 Posting Whiz in Training
If e.RowIndex.ToString > -1 Then
Diameter = DesignationsDataGridView.Rows(e.RowIndex).Cells(0).Value
endif
oussama_1 39 Posting Whiz in Training

what are you trying to do? explain more.

oussama_1 39 Posting Whiz in Training

when you use the getdata methode it collect the values in your query, your "fuel/litre" is no longer there. instead use this code to get your item

        Dim qry As OleDb.OleDbCommand
        Dim dr As OleDb.OleDbDataReader
        qry = New OleDbCommand("SELECT * FROM [fuel_allowance] WHERE [project number]='" & projcode & "' AND [employee number]='" & empcode & "'" & _
            "AND MONTH([current month])=" & currentdate.Month & " AND YEAR([current month])=" & currentdate.Year & "", YourConnection)
        dr = qry.ExecuteReader
        If dr.Read Then
            TextBox32.Text = dr("fuel/litre")
        End If
oussama_1 39 Posting Whiz in Training
oussama_1 39 Posting Whiz in Training

Ok try this

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SerialPort1.PortName = "COM1"
        SerialPort1.BaudRate = 19200
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.StopBits = IO.Ports.StopBits.One
        SerialPort1.DataBits = 8
    End Sub
    Private Sub DataReceived(ByVal sender As Object, _
                      ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
                      Handles SerialPort1.DataReceived
        If SerialPort1.BytesToRead > 0 Then
            Dim buff(SerialPort1.BytesToRead - 1) As Byte
            SerialPort1.Read(buff, 0, buff.Length)
            Me.BeginInvoke(New myDelegate(AddressOf SerialPortDelegate), buff)
        End If
    End Sub
    Public Delegate Sub myDelegate(ByVal buff() As Byte)
    Public Sub SerialPortDelegate(ByVal buff() As Byte)
        RichTextBox1.Text = System.Text.Encoding.ASCII.GetString(buff, 0, buff.Length)
    End Sub
End Class
oussama_1 39 Posting Whiz in Training

You need to create the installer (go to your project properties then go to publish - publish wizard) then on the user machine double click on the installer. also make sure to set your application platform on X86 for it to work on both machines (32bit and 6bit), for that go to build - configuration manager - platform - new - new platform: X86 - ok - close.
good luck.

oussama_1 39 Posting Whiz in Training

hmm..your code seems legit, but you didn't tell what's the error vb gives you and at what line

oussama_1 39 Posting Whiz in Training

Yesit does. where is your dataReceived(reading) code? please post it here