oussama_1 39 Posting Whiz in Training

You need to target the table inside the datatable:
If i < dt.Tables(0).Rows.Count - 1 Then

oussama_1 39 Posting Whiz in Training

oops sorry.

without using %

oussama_1 39 Posting Whiz in Training

if any number modulus 2 is zero then it's even otherwise it's an odd number so your condition would be
if (Num%2==0) sop("EVEN");

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

Your problem is in the invoice class, instead of setting your variables properly you are giving them a value of 0.
so change these:

 public void setPartNumber(String pNumber){
pNumber = partNumber;
}
public void setPartDescription(String pDesc){
pDesc = partDescription;
}
public void setQuantityPurchased(int qPurchased){
qPurchased = quantityPurchased;
}
public void setPricePerItem(double pItem){
pItem = pricePerItem;
}

to:

 public void setPartNumber(String pNumber){
partNumber = pNumber;
}
public void setPartDescription(String pDesc){
partDescription = pDesc;
}
public void setQuantityPurchased(int qPurchased){
quantityPurchased = qPurchased;
}
public void setPricePerItem(double pItem){
pricePerItem = pItem;
}
oussama_1 39 Posting Whiz in Training

Ok since you are using time to start your sound, add the stop code and initiate it at let's say 12:01AM fair enough?

oussama_1 39 Posting Whiz in Training

No put the check code before "cmd1.ExecuteNonQuery" in the button1_click event and change this:

            If DtSet.Tables(0).Rows(i).Item(0).ToString = Login.txtEmpID.Text Then
                Button1.Enabled = False
                Exit sub
            End If
oussama_1 39 Posting Whiz in Training

hmm.. you can make this even faster by selecting only your id column.
btw this "select * " means select everything

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

of course your way works..just give me a sec.

oussama_1 39 Posting Whiz in Training

oh ok hah...just disable the submit button
cmd1.ExecuteNonQuery
Button1.enabled = false

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

Your code will not loop the sound! is this code placed inside a loop? if yes add break; to it.

oussama_1 39 Posting Whiz in Training

Ok here's couple of things you can try:

  • Find out what the error is by adding this code:

    Try
    'your code here
    Catch ex As Exception
    MessageBox.Show(ex.Message & " - " & ex.Source)
    End Try

  • Go to your project properties >> publish >> then check the "application files" and the "prerequisites" button, so that you can add everything your program needs to operate properly, everything you add will be added to the installer.

  • Change your targeted platform to X86 bit so that your program will work on both systems (32-bit and 64-bit).
    go to Build >> configuration manager >> platform >> new >> X86 >> ok.

Good Luck

oussama_1 39 Posting Whiz in Training

Add this to line 88

YourDatagrid.DataSource = ds.tables(0)
oussama_1 39 Posting Whiz in Training

For input letter+number:

r = Integer.parseInt(choice.substring(1, 2)) - 1;
c = (int) (choice.charAt(0) - 'A');

and for the part "loop for once" i didn't understand but as far as i know, there's no such a thing, you want to loop once; just write the code without a loop.
hope this helps.

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

What did you write in the cmd?

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

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

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
If e.RowIndex.ToString > -1 Then
Diameter = DesignationsDataGridView.Rows(e.RowIndex).Cells(0).Value
endif
oussama_1 39 Posting Whiz in Training

in the timer tick event, you can also try if statement

    Private Sub Timer3_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer3.Tick
        If label7.text >= "45:00" Then
            Dim timedifference As TimeSpan = DateTime.Now.AddMinutes("45").Subtract(starttime)
            Dim newdate As DateTime = timedifference.ToString
            Label7.Text = newdate.ToString("mm:ss")
        Else
            Dim timedifference As TimeSpan = DateTime.Now.Subtract(starttime)
            Dim newdate As DateTime = timedifference.ToString
            Label7.Text = newdate.ToString("mm:ss")
        End If
    End Sub
oussama_1 39 Posting Whiz in Training
Dim timedifference As TimeSpan = DateTime.Now.AddMinutes("45").Subtract(starttime)
oussama_1 39 Posting Whiz in Training

the animation speed works when you set the style to Marquee.
i recommand that you put it on continuous and change the progressbar maximum value to let's say 90 and change the time interval to 3000 this will make the progressbar increases slower and smoother.
please mark question solved.

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

read my answer in this

oussama_1 39 Posting Whiz in Training

Use the animation speed.

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

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

if your question is solved then mark it as such. for the other question start a new thread.
Click Here

oussama_1 39 Posting Whiz in Training

Yes.

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

Put dr.close in here:

            If dr.Read Then
                form2.ID.Text = dr("ID")
                form2.Age.Text = dr("Age")
                form2.Sex.Text = dr("Sex")
                form2.Name.Text = dr("Name")
                form2.show()
                dr.Close()
            Else
                MsgBox("No Such Account")
            End If
        Catch
        End Try

        CN.Close()