Netcode 33 Veteran Poster

it would be better u post a sample of your codes and then, corrections can be made.
you would learn better and faster that way.

Netcode 33 Veteran Poster

yes. you can have only one MDI Parent in a project. just call up Family Xa from
FamilyX but both are MDI child of the main form (MDI Parent)

Netcode 33 Veteran Poster

you did not get a good algorithm from the start. let me give you a description:
1. First, have an MDI Parent window which would serve as your main form
2. add a tool strip to the main form(MDI)
3. add a new form and call it your familyA
4. add a tool strip or menu strip to the FamilyA form and label the drop down menus accordingly
5. add a new form (this should be familyA1 to add additional information) and should be called up from within FamilyA.
6. repeat steps 3 to 5 to create as many more forms and subsections as you wish

NOTE: all other forms excluding MDI Parent should be set as an MDI child to the MDI parent

Netcode 33 Veteran Poster

set the label's autosize property to true

Netcode 33 Veteran Poster

so what exactly do you want? do you want the MDI Child not to be displayed at all? If
you dont want the pop-up to show when you open other windows, then you have to open the
pop up as a dialog. this would make you respond to the pop up and close it before you can move to any other window.
In other words, use

me.dispose 
form1.showdialog
Netcode 33 Veteran Poster

its a default styling in visual studio. it shows the button has the focus

Netcode 33 Veteran Poster
Imports System.Data
Imports System.Data.SqlClient

Public Class Form1


 ' Declare objects...
    Dim objConnection As New SqlConnection _
    ("server= localhost;database= MSS;user id= sa;password=clement;")
    Dim objDataSet As DataSet
    Dim objDataView As DataView
    Dim objCurrencyManager As CurrencyManager
'create object to handle SQLcommands
            Dim objcommand As SqlCommand = New SqlCommand

            With objcommand
                .Connection = objConnection
                .CommandText = "INSERT INTO TableName" & _
               "(ColumnName)" + _
                "VALUES (textbox1.text)"
            End With

            objConnection.Open()
            objcommand.ExecuteNonQuery()
            objConnection.Close()

            'prompt to alert the user on successful record entry 
            Dim alert As DialogResult = _
                    MessageBox.Show( _
                     "entry successfully:" + vbCrLf & _
                     "Do you wish to enter another?", _
                        "Midwife", MessageBoxButtons.YesNo, _
                            MessageBoxIcon.Question)

            'case statement to capture user response and act accordingly 
            Select Case alert
                Case Windows.Forms.DialogResult.Yes
                    ClearControls()
                Case Windows.Forms.DialogResult.No
                    Me.Dispose()
            End Select

        Catch ex As Exception
            MessageBox.Show("registration failed!" & vbCrLf & _
            ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

        End Try
Netcode 33 Veteran Poster

why not make your search in the same format as in sql server
in order to avoid errors

Netcode 33 Veteran Poster
textbox1.text= combobox1.selecteditem.tostring
Netcode 33 Veteran Poster

lets assume you have a button on the current child window(form1) named 'button1' and you have a form (control) named 'form2' you want to display while the current child window is disabled.

under the button1;

me.enabled = false 
form1.show

when you are through with your control form, there should be a button to close it
and take you back to your child window, lets call it 'btnClose'

under btnclose;

me.dispose 
form1.enabled =true
Netcode 33 Veteran Poster

first, the variable has to get its value from an input source, maybe a text box
so why not do something like this

"SELECT Product_Name FROM tb_ProductInformation" & _
WHERE Product_Name Like "'+ textbox1.text+'"
Netcode 33 Veteran Poster

instead, make a relationship between both tables.

Netcode 33 Veteran Poster

remove the existing one and try and add the database again to the server explorer

Netcode 33 Veteran Poster
If password = txtpasssword.text and username = txtusername.text
then 
me.dipose
mainForm.show
Netcode 33 Veteran Poster

For now, You're good to go. if there is to be need for a change, that would be when you start coding before you discover that. You cant finish a project when you've not started.

Netcode 33 Veteran Poster

continue with FireFox and avoid problems of IE

Netcode 33 Veteran Poster

Change your browser for a better browser

Netcode 33 Veteran Poster

Internet Explorer has crashing or freezing problems. I would suggest to anyone who has this problem to download any other browsers like Google Chrome, Opera, Mozilla Firefox. All these browsers are free and work better than IE

Netcode 33 Veteran Poster

All you can do is to forcefully close IE. I suggest you download Opera,its a fast and free web browser with little or no crashing problems as in IE

Netcode 33 Veteran Poster

How can i send a friend request to someone on Daniweb?

jib commented: Not part of Vb +0
Netcode 33 Veteran Poster
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        Dim count As Integer
 
        Try
 
            If conn.State = ConnectionState.Closed Then
                conn.Open()
            Else
                conn.Open()
                userstring = "Select * from Hotel.dbo.Users where UserName = '" & UsernameTextBox.Text & "' and Password = '" & PasswordTextBox.Text & "'"
                usercmd = New SqlCommand(userstring, conn)
                count = usercmd.ExecuteScalar
 
                If count > 0 Then
                    MsgBox("records exist")
                    form2.show()
                    'load main form of application
 
                Else
                    MsgBox("no records found")
                   're-enter login username and password
 
                End If
 
                conn.Close()
 
            End If
 
        Catch ex As Exception
            Throw ex
            conn.Close()
 
        End Try
 
    End Sub
Netcode 33 Veteran Poster

chris, first you need to make a connection to sql server and then you can access the particular dbase and rable from which you want to perform user verification as in my codes below

Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click

        Try

            'variable to hold connectionstring 
            Dim objconnection As SqlConnection = New  _
                 SqlConnection("Server=localhost;Database=MSS;" & _
                    "user ID = sa; password = clement;")

            objconnection.Open() 'open connection to server 

            'this is the SQL select statement query that is performed
            ' to read the username and password from server 
            Dim SelectStmt As String = "SELECT * FROM Login WHERE User_Name ='" + txtUsername.Text + "' and " + _
                                "Password ='" + txtPassword.Text + "'"

            Dim objcommand As SqlCommand = New SqlCommand(SelectStmt, objconnection)
            
            Dim reader As SqlDataReader = objcommand.ExecuteReader

            If reader.Read Then

                              Me.Dispose()


            Else

                'integer variable to count the number of times
                'the user has tried loggin in
                Static count As Integer = 0

                'display promt 
                Dim prompt As DialogResult = _
                MessageBox.Show("Invalid Username or Password!", "Login Error", _
                MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)

                Select Case prompt

                    Case Windows.Forms.DialogResult.Retry
                        'keep login displayed for another trial 
                        txtUsername.Text = ""
                        txtPassword.Text = ""

                        count += 1 'increment counter by one 
                        If count = 3 Then
                            MessageBox.Show("High value of failed login attempts" & vbCrLf & _
                                           "Application will be terminated" & _
                                        " for security reasons", "Error", MessageBoxButtons.OK, _
                                        MessageBoxIcon.Stop)
                            End 'terminate application
                        End If

                    Case Windows.Forms.DialogResult.Cancel
                        Application.Exit()  'terminate application

                End Select

            End If
        Catch ex As Exception

        End Try
    End Sub
Netcode 33 Veteran Poster

use the .sdf file for this. if the .sdf file is used, you can use the same sqlconnection as when connecting to sql server but for the .mdf file, you would require knowledge of the sqlce Connection.

Netcode 33 Veteran Poster

i have tried, but it wont work. i have a multiple entry textbox where i enter the phone numbers with a comma separating them, i have a listbox (invisible to the user) where the phone numbers are separated into different strings as independent values and i want my program to search sql server and find all the numbers in the listbox and display the results on a datagrid with the names of the mobile owners. here is my code below. I need help ASAP

Private Sub findButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles findButton.Click

        
        //'separate numbers in display 
        Dim s As String = findTextBox.Text

        If s.Contains(",") Then

            Dim newstr As String() = s.Split(",".ToCharArray())

            For Each Comma As String In newstr
                ListBox1.Items.Add(Comma)

'//start database connection          
      Dim objDataAdapter As New SqlDataAdapter( _
                "SELECT Name, Mobile FROM PHC_Contacts WHERE Mobile In '" + ListBox1.Items.ToString + "'", objConnection)

                objDataSet = New DataSet()
                'Fill the DataSet object with data...
                objDataAdapter.Fill(objDataSet, "PHC_Contacts")

                'Set the DataView object to the DataSet object...
                objDataView = New DataView(objDataSet.Tables("PHC_Contacts"))

                'Set our CurrencyManager object to the DataView object...
                objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)

                Dim intPosition As Integer

                'If the search field is not empty then...
                If findTextBox.Text <> "" Then
                    objDataView.Sort = "Mobile"

                    'Find the user_id...
                    intPosition = objDataView.Find(comma)

                    Dim objdatatable As DataTable = objDataSet.Tables("PHC_Contacts")

'//datagrid display 
                    With dashBoard

                        .AutoGenerateColumns = True
                        .DataSource = objDataSet
                        .DataMember = "PHC_Contacts"

                        'Declare and set the alternating rows style...
                        Dim objAlternatingCellStyle As New DataGridViewCellStyle()
                        objAlternatingCellStyle.BackColor = Color.WhiteSmoke
                        dashBoard.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle

                    End With

                Else

                    MessageBox.Show("please …
Netcode 33 Veteran Poster

How can one search for multiple items at once and display the result in a datagrid? for example, i want to search for multiple mobile numbers (in sql server database)at once and display the found numbers and their corresponding names.

Netcode 33 Veteran Poster

it would be better you use a Microsoft Report Viewer to display your data instead of a datagridview. this will enable you ssave your data in both excel and pdf formats

Netcode 33 Veteran Poster

post the solution and just mark the post as solved

Netcode 33 Veteran Poster
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSearch.TextChanged
        If Not IsNumeric(.Text) Then
            MessageBox.Show("please enter a valid string", "Error" _
                             , MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
Netcode 33 Veteran Poster

explanation of my code:
localhost- means the sql-server exists on the local machine (your system)
database- the name of your database in sql-server
user id - the id used in loggin into your sql server
password- password to login into sql server

voila

Netcode 33 Veteran Poster
Dim objConnection As New SqlConnection _
            ("server=localhost;database= dbase-name;" + _
             "user id= id;password= @password;")
Netcode 33 Veteran Poster

you can enter these lines of code in areas where you have such errors. you have to convert the rows in a datatable to type 'string before' you can place them in textboxes.

For Each myDataRow As DataRow In objdatatable.Rows

              TextBox1.Text = Convert.ToString(myDataRow("item1"))
              TextBox2.Text = Convert.ToString(myDataRow("item2"))
              TextBox3.Text = Convert.ToString(myDataRow("item3"))
              TextBox4.Text = Convert.ToString(myDataRow("item4"))
                
                          
            Next
Netcode 33 Veteran Poster

the code written should by me should totally solve your problem even more than you expected.

Netcode 33 Veteran Poster
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Try

If TextBox1.Text = "students" And TextBox2.Text = "amaer" Then
Dim a As New Form2
a.Show()
Me.Hide()

 Else

                'integer variable to count the number of times
                'the user has tried loggin in
                Static count As Integer = 0

                'display promt 
                Dim prompt As DialogResult = _
                MessageBox.Show("Invalid Username or Password!", "Login Error", _
                MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)

                Select Case prompt

                    Case Windows.Forms.DialogResult.Retry
                        '//keep login displayed for another trial 
                        TextBox1.Text = ""
                        TextBox2.Text = ""

                        count += 1 'increment counter by one 
                        If count = 3 Then
                            MessageBox.Show("High value of failed login attempts" &              vbCrLf & _
                                           "Application will be terminated" & _
                                        " for security reasons", "Error", MessageBoxButtons.OK, _
                                        MessageBoxIcon.Stop)
                            End 'terminate application
                        End If

                    Case Windows.Forms.DialogResult.Cancel
                        Application.Exit()  'terminate application

                End Select

            End If
        Catch ex As Exception

        End Try
Netcode 33 Veteran Poster

you dont need a liscence to sell ur program written in VB. all u need is to buy a liscenced visual studio to enable create robust applications. You can get the free edition from Microsoft website which is the Express Edition

Netcode 33 Veteran Poster
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'increase progress bar by value of 20
'// check if not at Maximum to not go over, then add some value.
        If Not ProgressBar1.Value = 100 Then ProgressBar1.Value += 20     
    if ProgressBar1.Value = 100 Then '// check if ProgressBar is at Maximum Value.
            ProgressBar1.Visible = False '// set ProgressBar visibility to False.
            Form2.Show() '// show another Form.
        End If
    End Sub
Netcode 33 Veteran Poster
DATE: TEXTBOX1 = Date.Now.month & "/" & Date.Now.day & "/" & Date.Now.Year
TIME: TEXTBOX2 = Date.Now.ToShortTimeString
DAY: TEXTBOX3 = Date.Now.ToShortDateString
Netcode 33 Veteran Poster

this code block is to search a user data and display the result in a datagrid, see how you can adjust it to suit your use.....at least you will see where to add the data to the datagrid.

Netcode 33 Veteran Poster
Private Sub FindUser()

        Dim objConnection As New SqlConnection _
            ("server=localhost;database= MSS;" + _
             "user id=sa;password=clement;")

        Dim objDataAdapter As New SqlDataAdapter( _
        "SELECT * FROM User WHERE state = '" + txtSearch.Text + "'", objConnection)
        Dim objDataSet As DataSet
        Dim objDataView As DataView
        Dim objCurrencyManager As CurrencyManager


        objDataSet = New DataSet()

        ' Fill the DataSet object with data...
        objDataAdapter.Fill(objDataSet, "User")

        ' Set the DataView object to the DataSet object...
        objDataView = New DataView(objDataSet.Tables("User"))

        ' Set our CurrencyManager object to the DataView object...
        objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)

        Dim intPosition As Integer

        ' If the search field is not empty then...
        If txtSearch.Text <> "" Then
            objDataView.Sort = "state"

            ' Find the user_id...
            intPosition = objDataView.Find(txtSearch.Text)

            Dim objdatatable As DataTable = objDataSet.Tables("User")

            For Each myDataRow As DataRow In objdatatable.Rows

                fNameTextBox.Text = Convert.ToString(myDataRow("FirstName"))
                lNameTextBox.Text = Convert.ToString(myDataRow("LastName"))
                titleTextBox.Text = Convert.ToString(myDataRow("Title"))
                zoneTextBox.Text = Convert.ToString(myDataRow("zone"))
                stateTextBox.Text = Convert.ToString(myDataRow("State"))
                phoneTextBox.Text = Convert.ToString(myDataRow("Phone"))
                mailTextBox.Text = Convert.ToString(myDataRow("Mail"))
                snTextBox.Text = Convert.ToString(myDataRow("S/N"))
            Next

            With dtgSearchResult

                .AutoGenerateColumns = True
                .DataSource = objDataSet
                .DataMember = "Focals"

                ' Declare and set the alternating rows style...
                Dim objAlternatingCellStyle As New DataGridViewCellStyle()
                objAlternatingCellStyle.BackColor = Color.WhiteSmoke
                dtgSearchResult.AlternatingRowsDefaultCellStyle = objAlternatingCellStyle

            End With

        Else

            MessageBox.Show("please enter User's state", "User Search" _
                              , MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If

        If intPosition = -1 Then
            ' Display a message that the record was not found...

            tslAction.Text = "Record Not Found"
        Else
            ' Otherwise display a message that the record was
            ' found and reposition the CurrencyManager to that
            ' record...

            tslAction.Text = "Record Found"

            objCurrencyManager.Position = intPosition

        End If

    End Sub
Netcode 33 Veteran Poster

for sure the folder is invisible. if you're using windows vista or higher, click on the start button, type folder options, view tab, select the option button for show hidden files and folder. if windows xp, then open my computer, select tools menu, folder options, views tab, show hidden files and folder, click ok.
it should be visible in your C:\ drive now but you cant delete it manually.

Netcode 33 Veteran Poster
imports system.data 
imports system.data.sqlclient 

Public class form1 

private sub button1_click (byval sender as system.object.....)
dim con as sqlconnection = new sqlconnection ( _
"server = server name"; database = dbase name;  & _
user id = server id; password = server password;")

dim objcommand as sqlcommand =  new sql command 

with objcommand 
.connection =  con
.commandtext = "INSERT INTO tablename" & _
"(enter fields with comma seperating them)" & _
"VALUES (values for each field with a comma just as above)"
end with 
con.open()
objcommand.executenonquery()
con.close
jaanu_simi commented: nice. +0
Netcode 33 Veteran Poster

it sure wont work. the .exe file is more like a compiled copy of your program and definitely when it runs, its gonna search for your MS Access database, when it does not find it, it gives you the error

Netcode 33 Veteran Poster

i think you're trying to create a setup file. if am right, then follow these steps;
1.open the project
2.select the file menu, new project, select other project types and just beneath it select setup and deployment
3. follow the instructions as you proceed


these steps will help create a setup file so it can be installed on any system using whatever version of windows.

Netcode 33 Veteran Poster
dim con as sqlconnection = new sqlconnection( _
"server= server name; database= d-basename; user id = server id; password= server password;")
kvprajapati commented: N/A -2
Netcode 33 Veteran Poster

i wont give you a particular topic, instead i would give an advice as you suggested. i feel you search within yourself, if you are good in more than one language then know the one you perform best in...thats one step
step 2: get a topic you know would be easy for you to complete and would make you learn something new, but bear in mind that the topic you choose should be worth being called a project.
GOODLUCK

Netcode 33 Veteran Poster

hi everybody! i want to get all drives and their directories and sub-directories displayed on a tree view just as windows explorer. pls i need very comprehensive codes to do that...thanks

Netcode 33 Veteran Poster

i really dont see anything wrong with facebook yet

Netcode 33 Veteran Poster
imports system.data
imports system.data.sqlclient

public class form 1
 dim con as new sqlconnection = _
("server = localhost; database = databasename; user id = sdsfj; passwor = nhsdu")
dim objdataadapter as dataadpter
dim objdataset as dataset 

privates sub button1_clicked 
if radiobutton1.checked = true then 
con.open 
with objdataadapter 
.selectcommand =    dim strget as as string = "SELECT * FROM train WHERE trainID "'+radiobutton1.
''''
'''''
''''
''''
objdata.fill(objdataset, train)
with datagridview1

write codes here to display the data on a datagrid using a for..next loop
end with

Netcode 33 Veteran Poster

i would suggest you change the format of the field in MS Access from date/time to short date cos sometimes MS Access can be hell. just use the "Text" format of access, this would accept any data format.
if this does not work, then send me a message so i can send a sample project

Netcode 33 Veteran Poster

in your database you should have a primary key. this should be a unique number to identify each train you have on course. with this, you can use your sql SELECT statement to get the information you want
for example,
SELECT * from Trains WHERE TrainID = "354523"

Netcode 33 Veteran Poster

why not throw your question on board