manal 27 Junior Poster

i think you just need to add reference to System.configuration.dll

manal 27 Junior Poster

you can use split method in string class

Dim namepart(3) As String
         fullname = TextBox1.Text

        For i = 0 To TextBox1.Text.Length - 1
            namepart = fullname.Split(" ")
        Next
        TextBox2.Text = namepart(0)
        TextBox3.Text = namepart(1)
        TextBox4.Text = namepart(2)

you can read more about array here and about string here

manal 27 Junior Poster

I don't know if you can help .... is there a way how I can eliminate re-entering the account no and password in the Balance form.

Example .... to get data from Login form entries. This way the user does not have to re-enter his login details.

what I understand that you have two forms , one for logging in and the other one to show information for corresponding user , right?
then yes it is better to eliminate re-entering account's information in the other form , or there will be no need for log in form , you can pass the value you got in first parent form(log in form) to the child form(balance_info form)) ,
you can pass the txtAccountNo.text as parameter for the child form's constructor

If txtPassword.Text = p Then

                    MessageBox.Show("Welcome !!")

                     Dim initial As String
                    initial = Me.txtAccountNo.Text
                    Dim form2 As Form2

                    ' Create the child form.
                    form2 = New Form2(initial)
                    form2.Show()

in the form2 you need to overload the constructor
read this artical to show you how you can pass values between forms(or any objects)

good luck :)

manal 27 Junior Poster

read this it may help u

manal 27 Junior Poster

as you did here

Dim p As String = rdr(1)
If txtPassword.Text = p Then

you can show the data in lable or textbox

textbox1.text=rdr("column_name")
manal 27 Junior Poster

are you asking about how to loop thru database ? i think like this

count = Me.DataSet.Table_Name.Count
        For i = 0 To count - 1
            m = Me.DataSet. Table_Name.Rows(i).Item("Column_name")
            Select Case m
                Case "Leo"
                  Display image of Leo in   Me.DataGrid1.Item(i, 0)
                  .
                  .
                  .
                                      etc 

            End Select
manal 27 Junior Poster

use boolean varaible to indicate if the user enter correct value for each input like this

If Val(employeeid_txt.Text) > 10 Or Val(employeeid_txt.Text) < 1 Then
            MessageBox.Show("Employee Id Outwith Range 1 to 10 ", "Please re-enter", MessageBoxButtons.OK)
        Else
           [B]correct_EmployeeID=true [/B]
         End If

then if all inputs for user are correct , store that entry to your array

if correct_EmployeeID and correct_firstname and correct_surname and correct_gender and correct_position then 
  EmployeeRec(Index).Employeeid = employeeid_txt.Text
etc ..etc
End if

other thing about your code , your validation based on test the length of the user's input
and that not correct , I can enter something like "abcd" and your program will accept it in the gender input , it is better to compare the user's input string with "male" or "female"
and much better to make user select the gender , and position (use radio button). about the error messages , what if user make more than one error ! many messages will show and that will be annoying , use labels to show the error messages

If Val(employeeid_txt.Text) > 10 Or Val(employeeid_txt.Text) < 1 Then
            lable_error_id.text="Employee Id Outwith Range 1 to 10 , Please re-enter"         Else
           correct_EmployeeID=true 
End If
manal 27 Junior Poster

number = number * 4.3

i think that's wrong , you need to add 125,000 to the population grouth each year

number=number+(number*4.3)
Loop Until
count = 200000

other thing why you stop looping untill count=200 000 ?i think you mean number not count

manal 27 Junior Poster

int multiple = 0;

here is the error when multiple= 0 then it never enter the for loop since 1>multiple

just make multiple =2 and it should work

manal 27 Junior Poster
Private Sub btnPlcOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPlcOrder.Click

        custNumOfPizzas = txtPizza.Text
        custNumOfCokes = txtCoke.Text
        custAmtPaid = txtAmtPaid.Text

        Dim order1 As New Order(custNumOfPizzas, custNumOfCokes, custAmtPaid)

        Dim dailySummary As New DailySummary(custNumOfPizzas, custNumOfCokes, custAmtPaid)

        dailySummary.StoreOrder(order1)

        txtOutput.Text = dailySummary.ToString

        txtReceipt.Text = order1.ToString

        ClearForm()


    End Sub

i am not sure if this is your peorblem , but should not you declear dailySummary outside
btnPlcOrder_Click code ??
what i understand that each time you place order a new instance of daily summary will creat , where you need only one where you will store all the orders for the day .

manal 27 Junior Poster

what the error you got ?

manal 27 Junior Poster

Example:

If txtUserID and txtPassword = True then

while you configure your data adapter , the sql statment will be something like this

Select Name,  Surname from Tablel_name WHERE ([B]id=?[/B])

the question mark means that you will select specific row based on id (primary key)
then in your code you will verify that user entered correct information . after that replace the question mark with value you got from the user

OleDbDataAdapter.SelectCommand.Parameters("[B]ID[/B]").Value = TextBox1.Text
        OleDbDataAdapter.Fill(DataSet)

Show in label 1 Name
SHow in label 2 Surname
etc etc

Label1.Text = DataSet.Table_name.Rows(0).Item("Name") 
etc etc ..

hope that help you :)

manal 27 Junior Poster

daDocuments.Update(CType(bdsDocuments.DataSource, DataTable))

I think this not right , daDocuments.Update takes two argument one of them is dataset and the other is table

OleDbDataAdapter1.Update(DataSet11, "table_name")

also you can use OleDbCommandBuilder when DataTable maps to a single database table(means database table is not result of join operation)

manal 27 Junior Poster

welcome Dan :)

manal 27 Junior Poster
textbox1.databinding[B]s[/B].add("text",me.ds,"master_dept.dept_name[B]"[/B])
conn.connectionstring=""

here you should write the connectionstring

what the error you got ?

manal 27 Junior Poster

vb.net is easy to learn , I learned it to do my final project
There are many good books for learning vb.net that you can buy. See this link

the implementation (writing the code ) of your system will be the last step you do , you need now to fully understand your system and its function (analyzing it)

manal 27 Junior Poster

welcome Mick to Daniweb :)
and good luck in your study

manal 27 Junior Poster

"Never argue with idiots, they'll just bring you down to their level and beat you with experience."
:)

manal 27 Junior Poster

select DISTINCT[[B]name of my field[/B]] from table_name

the reason is this query differ from the orginal one . The name of my field must be the same in all queries

manal 27 Junior Poster

yes it is possible

num = Me.DataSet11.Your_Table_name.Count  
        For i = 0 To num - 1
            If Me.DataSet11.Your_Table_name(i).Item("date")="1/1/1900"  then 
              Me.DataGrid1.Item(i, Column_index) = "#"
            End If
        Next
manal 27 Junior Poster

maybe two users try to change the same database at same time , read this link and this too

good luck :)

manal 27 Junior Poster

according to this link DidWork is integer variable

Dim DidWork As Integer = openFD.ShowDialog()

so in this line

If DidWork <> DialogResult.Cancel Then

u make sure that user did not choose cancel button in OpenFileDialog

i hope thats help u :)

arjunsasidharan commented: +rep +3
manal 27 Junior Poster

http://vbjunkies.com/Tutorial/47792CB0-0990-4BD8-BF84-B6063C4C9BBC.dcik

Every data bound control exposes an ItemDataBound event that we can handle. This event fires with each item that is data bound. In the case of a DataGrid, the ItemDataBound event fires for each DataGridItem (row) in the DataGrid. Since we can capture the ItemDataBound event for each row, we can capture values from the row, such as the CustomerID for the specified row, and dynamically create and add controls to the Controls collection of one of the columns (cells).

other links
http://datawebcontrols.com/faqs/CustomizingAppearance/ConditionalFormatting.shtml
http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datagrid.itemdatabound(vs.71).aspx

manal 27 Junior Poster

Dim conn As New SqlConnection(connstr1)
Dim sql As String
sql = "Select * from address1"
'Dim da As SqlDataAdapter
Dim cmd As New SqlCommand(sql, conn)
conn.Open()
Dim ds As New DataSet()
da = New SqlDataAdapter(sql, conn)
da.Fill(ds, "Address1")
maxrows = ds.Tables("Address1").Rows.Count
inc = -1
conn.Close()
If inc <> maxrows - 1 Then
inc = inc + 1
TextBox1.Text = ds.Tables("address1").Rows(inc).Item("rollno").ToString
TextBox2.Text = ds.Tables("address1").Rows(inc).Item("name").ToString
End If

first this code must be written in the next_button (by double click next_button to access its code )
second you need to initiate the variable inc outside the next button code (global variable)
in your code now , each time you click next, inc will be -1 at start and therefore always the same record will be displayed

manal 27 Junior Poster

this site is good for beginners
http://www.homeandlearn.co.uk/NET/vbNet.html

:) GoOd Luck

manal 27 Junior Poster
manal 27 Junior Poster

I am not sure if I understand you well :S
do you want to clear the textbox from data when user click some button ?
you do like this

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = ""

and that for all ur textboxes

manal 27 Junior Poster

What I understand that u want to code calculator and u asking about the equal_button
I think u just need to know which button has been clicked (to determine either to add or subtract or whatever ) , so declare Boolean variables lets say add and subtract ,at start both will be false ,

Dim add As Boolean
Dim subtract As Boolean

when add_button clicked make add =true and the other variables false
In equal button check which variable is true then do the calculation needed

hope this will help u

manal 27 Junior Poster

but i dont c any changes-inspite i declare it has global variables & else if i use while-loop instead of if-loop And also it returns maxrws=26)
plz helpmm

first of all if is NOT loop u use it to test condition and i do not know why u using the for or while loop !
in ur code each time u press next button what will happen is
1/ make connection to database
2/get number of raws in table
3/goes through ALL the record but u actually display the same one each time .

but when u define global varaible , each time user press next button it will incremnt by one so u keep track of the next record . and NO need for for loop .

i hope its clear now , :S

manal 27 Junior Poster

Ok
Your code won't display the next record , it will always display the same record over and over , any way I think it’s the last one in table not the first.
The problem is u not keep track of which the next record is ! the for loop here dose NOT do that too.
To solve this, first define global variable

Public next_record As Integer

Double click Next Record button to access the code and write this

If next_record <= maxrws - 1  Then
id_txt.Text = ds.Tables("table1").Rows(i).Item("ID").ToString()
name_txt.Text = ds.Tables("table1").Rows(i).Item("Name").ToString()
age_txt.Text = ds.Tables("table1").Rows(i).Item("Age").ToString()
sex_txt.Text = ds.Tables("table1").Rows(i).Item("Sex").ToString()
area_txt.Text = ds.Tables("table1").Rows(i).Item("Area").ToString()
next_record = next_record + 1    ' here we keep track of which the Next record is
Else                 
   …………………    ' write what u want to do when it reach the last record ,  maybe to start all over again or anything 


 End If

Good luck

manal 27 Junior Poster

Set the multiselect property of OpenFileDialog to true

OpenFileDialog1.Multiselect = True

After this the user can select more than one file by pressing shift and selecting the files
you can get the names of all selected files by the property FileNames
by writing something like this

Me.ListBox1.Items.Add(Me.OpenFileDialog1.FileNames(i))

Check this link to read more about filedailog properties
http://www.startvbdotnet.com/controls/dialog.aspx

manal 27 Junior Poster
Public Sub New(param1 As String, param2 as String)
Me.New(param1)
Try
...
Catch ex As Exception
Throw New Exception (...)
End Try
End Sub

i think this will be enough , since the code of Me.New(param1) will be executed first , so u will catch the errors produced by the first constructor , right ?

manal 27 Junior Poster

I think there is ambiguity of the type of textbox , u need to decide whether it is Windows textbox or web control text box
Try this

Dim age1 As Integer = CType(e.Item.FindControl("Age"), Web.UI.WebControls.TextBox).text

Or

Dim age1 As Integer = CType(e.Item.FindControl("Age"), Windows.Forms.TextBox).text

i hope this will help u

manal 27 Junior Poster

http://www.startvbdotnet.com/controls/printdialog.aspx

read this and i hope it will help u to write ur own code

manal 27 Junior Poster
manal 27 Junior Poster

custrow.AcceptChanges()
Me.oledb_cust_edit.Update(Me.DataSet11)

here is the problem
after calling AcceptChanges the RowState property of custrow will be set to Unchanged so Me.oledb_cust_edit.Update(Me.DataSet11) will return NO change to the dataset

to solve this just inverse the two lines

Me.oledb_cust_edit.Update(Me.DataSet11)
custrow.AcceptChanges()
manal 27 Junior Poster

the type of textbox.text and label.text is string , i think u need to Convert it to integer or double

manal 27 Junior Poster
manal 27 Junior Poster

my first item in the ComboBox is NOT THE LAST ENTRY in my previous session.

I want Index (0) to be the last URL entered.

I cant seem to get the last URL typed to appear on the top of the list.

My other problem is that now that i have a text file with 600 websites i've visited, when the streamreader loads the file, my ComboBox has 600 sites in the list.
How can i have Streamreader load ALL of the lines, but only display 25 in the Combobox?

create array of strings and store in it the lines of text file then do something like this

If arr.Length >= 25 Then
            count = 25
        Else
            count = arr.Length
        End If


        Do While count > 0
            count = count - 1
            ComboBox1.Items.Add(arr(count))

        Loop
manal 27 Junior Poster
strRevText = array.Reverse    'Here is my problem

thats becouse array.Reverse needs an argument and the other thing it does not produce value so you can't assign it to strRevText

strRevText = Me.lblResult.Text

here is problem too , here u do not show the result !

after the correction this is ur code

Dim strOrgText As String
        Dim strRevText As [Char]()
        Dim array As Array

        strOrgText = Me.txtTheString.Text
        strRevText = strOrgText.ToCharArray
        [B]array.Reverse(strRevText)   
        Me.lblResult.Text = strRevText[/B]

or u can use StrReverse function like this

Me.lblResult.Text = StrReverse(Me.txtTheString.Text)
hoosier23 commented: works +1
manal 27 Junior Poster

Second, I want the user drag and drop the parts of the picture into the playing board . How I can do that ?
I search on internet , but i couldn't find any helpful information

:-/

check this link
http://pages.cpsc.ucalgary.ca/~carman/481/examples/vb.net/dragdrop.html

Good luck

manal 27 Junior Poster

You need to add reference to ur projeact
Project --->> Add Reference --->> from the .Net tab select System.Web.dll

GoOd Luck

manal 27 Junior Poster

Add ColorDialog control to the form , then change its property to the way you want it to show .

to show the dailog

ColorDialog1.ShowDialog()

you can get the color that user selected by ColorDialog1.Color after this you can set the backcolor of form to this color

manal 27 Junior Poster

u mean how to play flash movie in vb.net ?

add Shockwave Flash Object from COM Component ( by right click on tool box -->>Add/Remove Items -->> COM Component tab --->> Shockwave Flash Object) then drag the item that will appear in tool box to the form

on play button add the code that will play the movie and u may need other buttons too

Good Luck : )

manal 27 Junior Poster
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head><title>BMI Calculator</title>

 <script type="[COLOR="Red"][B]text/[/B][/COLOR]javascript">
 <!-- Hide script from non-script-friendly browsers
  function BMI Calculator(bmi)
  {
    var bmi = w / (h*h);
    return bmi;
  }
 //stop hiding the script-->
 </script>
</head>

<body>
<script type="[COLOR="red"][B]text/[/B][/COLOR]javascript">
    <!-- Hide script from non-script-friendly browsers
    var n;
    var a;
    var h;
    var w;
    var bmi;
    n = prompt("What is your age? ","");
    if (n <= 17)
    {
    document.write("We are unable to calculate your BMI");
    }
    else if([COLOR="red"][B]n[/B][/COLOR] => 18)
    {
    h = prompt("What is your height in metres?","");
    w = prompt("What is your weight in kilograms?","");
    bmi = w / (h*h);

    if (bmi <= 19)
    { 
    message = "Underweight"; 
    }
    else if (bmi >= 20 && bmi <= 25)
    { 
    message = "Acceptable"; 
    }
    else if (bmi >= 26 && [COLOR="red"][B]bmi[/B][/COLOR] <=30)
    { 
    message = "Overweight"; 
    }
    else if (bmi >= 31)
    { 
    message = "Obese"; 
    }
    else
    { 
    message = "Error!"; 
    }

    content = ("<html><head><title>Your BMI</title></head><body><h1>BODY MASS INDEX (BMI) CALCULATOR</h1>
    <p>Your height= " + h + "<br>Your weight= " + w + [COLOR="red"][B]"[/B][/COLOR]<br>Your BMI= " + bmi + "</p>
    <p><h2>what your BMI Indicates</h2><br>" + message + "</p>"[COLOR="red"][B])[/B][/COLOR];

    document.write(content);
    }
    // stop hiding the script-->
</script>
</body>
</html>

it had simple mistakes , after i correct it , it works with me and my bmi was acceptable :cheesy:

manal 27 Junior Poster

hi

how can I change the cursor's shape im my site

i found this

<A HREF="index.html" style="cursor:crosshair">home</a>

this change it when it moves over the link but i want the cursor to be like this always

thanx in advance

manal 27 Junior Poster

wow --->> me :lol:

manal 27 Junior Poster

hi ,
When you select the first row there is no problem coz the event fires once ok, but the problem accurse when you select other row coz the event (which is ListView1_SelectedIndexChanged) fires twice once for deselect the first row and the other for select the second row. So the message "Specific argument was out of the range of valid values. Parameter name: Index " show because deselect the first row you chosen. I hope I could explain well :cheesy:

Any way the solution is by adding if statement before the retrieve of the list row information

If ListClient.SelectedItems.Count = 0 Then Exit Sub
       Try
            With ListClient

                intIndex = .SelectedIndices(0)

                lngPClientId = .Items(intIndex).Text
                Me.lblClientId.Text = lngPClientId
                txtClientName.Text = .Items(intIndex).SubItems(1).Text
                txtAcctMgr.Text = .Items(intIndex).SubItems(2).Text

                intIndex = 0
            End With

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
manal 27 Junior Poster

hi:cheesy:
i used dataset and dataadptor for display the other data in text box
the sql query will be like this

select email , name
from customer
where id =?

then douple click in combobox and write this code (douple click means the code will excute when user select value )

'here you select the row from table with id that user choose from comboBox
OleDbDataAdapter2.SelectCommand.Parameters("ID").Value = Me.ComboBox1.Text

        Me.DataSet21.Clear()
        Me.OleDbDataAdapter2.Fill(DataSet21)

        TextBox1.Text = DataSet21.Tables("customer").Rows(0).Item("email")

        TextBox2.Text = DataSet21.Tables("customer").Rows(0).Item("name")

i hope this what u want

manal

manal 27 Junior Poster

hi
select cobobox and in right you will see the properties
1/datasource make its value the table in dataset you want
2/ ValueMember make its value the coulmn name (name of custeomer)

when your form load you fill dataset

Me.DataSet11.Clear()
Me.OleDbDataAdapter1.Fill(DataSet11)

now the list of comboBox has the names of ur customers

i hope this help