Begginnerdev 256 Junior Poster

If your server is not set to allow execnonquery to return values, you could be getting a null value back from that.

You can try ExecuteScalar also to see if that returns the rows affected.

I too have had issues with ENQ not returning values.

success = cmdSQL.ExecuteNonQuery()

Begginnerdev 256 Junior Poster

Ok, Thanks Decept.

I didn't know if the post crossed the line enough to be considered a violation.

Thanks again!

Begginnerdev 256 Junior Poster

It has just come to my attention that he has indeed used this for spam. He is also using it for profit too.

Would this not be considered a breach of forum rules?

Begginnerdev 256 Junior Poster

If the DLL is a custom DLL, you can set the DLL's assembly information in the MyProject > Application > Assembly Information

You can type the original creation date in the Description field.

Begginnerdev 256 Junior Poster

Can you please post a larger snippet of the code?

Where is the memory stream being declared?

Begginnerdev 256 Junior Poster

Can you please post a code snippet of the area the error is being thrown?

I have never seen that error thrown, possibly a custom error message?

Begginnerdev 256 Junior Poster

I have not tried it before, but you can make use of ReDim Preserve.

You can recreate the array every time it is needed.

iFrolox commented: And what i needed to finish, thx :) +0
Begginnerdev 256 Junior Poster

You could try something like:

Dim curItem as Integer = 3
ar.RemoveAt(3)
For i = CurItem to ar.Count - 2
    ar(i) = ar(i + 1)
Next

ar.RemoveAt(ar.Count - 1)

This will "push" everything up one, then delete the last one.

iFrolox commented: Really important, i needed this, thank you +0
Begginnerdev 256 Junior Poster

You have alot of over head here I see.

Is using a database out of the question?

If it is, then what about using an ArrayList?

When using an array list, you can simply store each account in the ArrayList and remove one by:

Dim ar As New ArrayList
Dim index As Integer = 3
ar.RemoveAt(index) 'This will remove the fourth entry.'

This will remove the account at the fourth entry in the array.

You will need to cast to the account type when using arraylists too.

Example:

Dim refAccount as Accounts


refAccount = TryCast(ar(0),Accounts)

If refAccount IsNot Nothing Then
    'Cast was successfull. Continue working'
Else
    'Cast was unsuccessfull. Halt application or implement fault tolerance.'
End If
Begginnerdev 256 Junior Poster

Here is a website containing small tutorials to help you on your way.

As for a sample project, you can check Here.

Begginnerdev 256 Junior Poster

You can do something like this:

    Dim itm As ListViewItem
    Dim total As Single
    For Each itm In ListView1.Items
        If itm IsNot Nothing Then
            For i = 0 To itm.SubItems.Count - 1
                total += CSng(itm.SubItems.Item(i).ToString)
            Next
            itm.SubItems.Add(total)
        End If
    Next

See if this works.

Begginnerdev 256 Junior Poster

When using text/strings in a sql string, always wrap the values with ' '

Example:

Dim sqls As String = "INSERT INTO table(col1,col2,col3) VALUES ('" & text1.Text & "','" & text2.Text & "','" & text3.Text & "')"

If you are wanting to use a textbox value as a data type other than text, you can aways cast the string to the desired data type.

Example:

Dim sqls As String = "INSERT INTO table(col1,col2,col3) VALUES ('" & text1.Text & "'," & Cdbl(text2.Text) & "," & Cint(text3.Text) & ")"

This way, of course, is less tolerant of mistakes. I suggest casting and storing to a variable before binding to a statement string. I usually try something like:

Private Function TryConvertDecimal(ByVal input As String) As Decimal
    Try
        Dim dec As Decimal = CDec(input)
        Return dec
    Catch ex As Exception
        Return Nothing
    End Try
End Function

I will usually create one check function for each data type I am using. This way I can just check for null values (nothing) like so:

If TryConvertDecimal(text1.Text) IsNot Nothing Then
    'Do work'
Else
    MsgBox("There was a problem converting input data, check value: " & text1.Text)
End If

This will give your application a lot more fault tolerance.

Hope this helps!

BegginnerDev

Begginnerdev 256 Junior Poster

Looks good, great job!

Are you having any issues with it?

Begginnerdev 256 Junior Poster

Is it just me or does it seem that Branickiod just copy > pasted from a project/product description?

Begginnerdev 256 Junior Poster

If I understand what you are asking; you will want to include the folder in the project's deployment.

If I am misunderstanding what you are asking, and you want to connect to the dev pc from the deployment pc, you will need to setup a share for the deployment pc to connect to. In this share you will want to have the folder with all of the images/data in it.

Begginnerdev 256 Junior Poster

So far, it looks as if you are on the right track.

Now you will have to generate some false answers; such as creating an array of known false answers and pull randomly from that arra

Begginnerdev 256 Junior Poster

Click Here for an article on XML parsing from VB.Net

Begginnerdev 256 Junior Poster

You will need to implement an ArrayList then cast from the arraylist to a string.

Example:

Dim ar As New ArrayList

'Removing'
ar.RemoveAt(0)


'Casting'
 Dim s As String

 s = TryCast(ar(0),String)

'If the cast fails it will return Nothing. Make sure to test for failure.'

If s IsNot Nothing Then
'Do work'
End if

'-or-'

If IsNothing(s) = false Then
'Do work'
End if

Hope this helps! :)

Begginnerdev 256 Junior Poster

You can try placing an IIF into the lines to test against empty or null values.

Example:

    objWriter.WriteLine(" <Update Name='SH_REQ_DEL_DATE' Value= '" & IIf(sqlReader.GetString(0), IsNothing(sqlReader.GetString(0)) = False, IsNothing(sqlReader.GetString(0)) = True) & "'/>")
Begginnerdev 256 Junior Poster

Couple of Possibilities:

Are you connecting to a database that is on a school PC?

If you are then you will need an instance of this database on your home PC?

-or-

It is possible that you can't access the database from home.

Are you trying to connect to SQL without having it installed on your home PC?

Begginnerdev 256 Junior Poster

I have found a solution by using the DirectCast function.

Here is what I used for the solution:

Protected Sub frmStatus_ItemInserting(sender As Object, e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles frmStatus.ItemInserting   
    Dim cboS As DropDownList = DirectCast(Me.frmStatus.FindControl("cboStatus"), DropDownList)
    Dim cboA As DropDownList = DirectCast(Me.frmStatus.FindControl("cboAction"), DropDownList)
    Dim cboC As DropDownList = DirectCast(Me.frmStatus.FindControl("cboChange"), DropDownList)

    If IsNothing(cboS) = False And IsNothing(cboA) = False And IsNothing(cboC) = False Then
        If cboS.SelectedItem.Text = "-- Select Status --" Then
            e.Cancel = True
        ElseIf cboA.SelectedItem.Text = "-- Select Action Type --" Then
            e.Cancel = True
        ElseIf cboC.SelectedItem.Text = "-- Select Default Change Status --" Then
            e.Cancel = True
        Else
            e.Cancel = False
        End If
    Else
        MsgBox("Could not convert controls.")
    End If
End Sub
Begginnerdev 256 Junior Poster

Hello my fellow Daniwebers, I have a question for you.

I have quite an odd problem that I have researched and have not been able to find a solution.

I have a formview, named frmStatus, from which I am trying to retrieve controls to check for values.

The form is in Insert mode and contains three drop down boxes, from which I am trying to reference.

Here is what I have tryed:

'Declaration of variables'
Dim cboStatus As New Control
Dim cboAction As New Control
Dim cboChange As New Control


'Assigning the controls.'
Protected Sub frmStatus_PreRender(sender As Object, e As System.EventArgs) Handles frmStatus.PreRender
    cboStatus = Me.frmStatus.FindControl("cboStatus")
    cboAction = Me.frmStatus.FindControl("cboAction")
    cboChange = Me.frmStatus.FindControl("cboChange")
End Sub


'Trying to capture the insert and check for default text.'

 Protected Sub frmStatus_ItemInserting(sender As Object, e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles frmStatus.ItemInserting   
    Dim cboS As DropDownList = TryCast(cboStatus, DropDownList)
    Dim cboA As DropDownList = TryCast(cboAction, DropDownList)
    Dim cboC As DropDownList = TryCast(cboChange, DropDownList)

    If IsNothing(cboS) = False And IsNothing(cboA) = False And IsNothing(cboC) = False Then
        If cboS.Text = "-- Select Status --" Then
            MsgBox("Please select status.")
            e.Cancel = True
        ElseIf cboA.Text = "-- Select Action Type --" Then
            MsgBox("Please select action type.")
            e.Cancel = True
        ElseIf cboC.Text = "-- Select Default Change Status --" Then
            MsgBox("Please select change status.")
            e.Cancel = True
        Else
            e.Cancel = False
        End If
    Else
        MsgBox("Could not convert controls.")
    End If
End Sub

From the code above, the top level else is always thrown.

What am I doing wrong?

Thanks,
Begginnerdev

Begginnerdev 256 Junior Poster

When you say that it refreshes the workbooks, are you meaning it updates data with current data and then saves as a different workbook?

Are you using the original workbook as a template, or as a backup for the previously updated data?

Begginnerdev 256 Junior Poster

Have you verified that metroTilePanel1 exists?

Have you checked to see if it has been renamed by accident?

If not, you can add the sub as a handler manually by deleting the "Handles metroTilePanel1.ItemClick" off of the end and:

'Add this to your form load.'


addHandler metroTilePanel1.ItemClick, Address Of metroTilePanel1_ItemClick

'This will manually add the event.
Begginnerdev 256 Junior Poster

Place this in the form's load event:

    Me.Width = Screen.PrimaryScreen.Bounds.Width - 20
    Me.Height = Screen.PrimaryScreen.Bounds.Height - 20
Begginnerdev 256 Junior Poster

Are you speaking of an interface as a GUI or an interface as a means for polymorphism?

Begginnerdev 256 Junior Poster

The problem is the web browser hasn't loaded the page correctly.

Has anyone had any experience with delaying code execution until a browser has loaded the document?

I have used the web browsers readystate in a while loop:

While wb.ReadyState <> WebBrowserReadyState.Complete
End While

but it sits in an infinite loop.

Begginnerdev 256 Junior Poster

Have some code here, but I seem to be having a problem.

The program throws a null reference exception in the GetImage function when it runs normally. Here is the funny thing, when I cycle through it in debug mode, it works fine!?

Here is what I have so far:

Imports System.Data.OleDb
Imports System.IO
Imports System.Net

Public Class main_form
    Implements IPictures
    Private curDir As String
    Private selectedControl As Integer
    Private webAddress As String = ""
    Private wb As New WebBrowser
    Private hd As HtmlDocument
    Private hc As HtmlElementCollection
    Private he As HtmlElement

    Public Property Website As String
        Get
            Return Me.webAddress
        End Get
        Set(value As String)
            Me.webAddress = value
        End Set
    End Property

    Private Sub OpenDirectoryToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenDirectoryToolStripMenuItem.Click
        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            If FolderBrowserDialog1.SelectedPath <> "" Then
                If IO.Directory.Exists(FolderBrowserDialog1.SelectedPath) = True Then
                    Me.curDir = FolderBrowserDialog1.SelectedPath & "/"

                    CreatePanels(getPictures(IPictures.SourceType.Local, Me.curDir))
                End If
            End If
        End If
    End Sub

    Public Function CreateIndexedList(path As String) As System.Collections.ArrayList Implements IPictures.CreateIndexedList
        Try
            If IO.Directory.Exists(path) Then
                Dim al As New ArrayList
                Dim dir As New IO.DirectoryInfo(path)
                Dim fi As IO.FileInfo

                For Each fi In dir.GetFiles()
                    al.Add(fi.FullName)
                Next
                Return al
            Else
                MsgBox("Path was incorrect.")
                Return Nothing
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
            Return Nothing
        End Try
    End Function

    Public Function getPictureCount(path As String) As Integer Implements IPictures.getPictureCount
        Try
            If IO.Directory.Exists(path) Then
                Dim i As Integer
                Dim dir As New IO.DirectoryInfo(path)
                Dim fi As IO.FileInfo
                For Each fi In dir.GetFiles()
                    i += 1
                Next
                Return i
            Else
                MsgBox("Path was incorrect.")
                Return …
Begginnerdev 256 Junior Poster

I keep noticing that when the test message is called, it is calling this sub:

Friend Overridable Sub TestMessage()
End Sub

And not the override.

That is with changing this:

  Private fcurrentcontrol As TutorialControl

To this:

  Private fcurrentcontrol As New TutorialControl

And using your code:

 CurrentControl.TestMessage()
Begginnerdev 256 Junior Poster

I was able to fix your problem by doing the following:

    Dim gf As New GridForm
    gf.TestMessage()

This takes away the Nullreference exception, but does not post "Tested OK" in your text box.

I see you are using a poperty to assign the values:

   Public Property CurrentControl As TutorialControl
                Get
                          Return fcurrentcontrol
                End Get
                Set(ByVal value As TutorialControl)
                          If fcurrentcontrol Is value Then
                                    Return
                          End If
                          fcurrentcontrol = value
                End Set
   End Property

But I do not see where you are assigning it any values.

Begginnerdev 256 Junior Poster

Sorry, I was unable to recreate your problem. I can't download your project due to usage policies. I am still trying to think of what possibly could be wrong.

Begginnerdev 256 Junior Poster

1)You will want to start with connecting to the database.
There are many different types of connection providers, you will have to chose the one you like the best.

2)You will have to retrieve and store the information in a data table.
You will find out more about this when researching connecting to a database.
You will need to write queries to return unique values.

3)You will cycle through the table, writing the values to a text file.
You will need to research stream readers/writers.

Tutorials:

Database Connection:
here
Querying Database:
here
Writing Data to Text File:
reader
writer

Begginnerdev 256 Junior Poster

Carrige return line feeds. It reperesents the new line character, aka the enter button.

You will have to read the data in the file one char at a time and pull in what you will need.

Begginnerdev 256 Junior Poster

This is how far I have gotten as of right now;

Imports System.Data.OleDb
Imports System.IO

Public Class main_form
    Implements IPictures

    Private curDir As String

    Private Sub OpenDirectoryToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenDirectoryToolStripMenuItem.Click
        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            If FolderBrowserDialog1.SelectedPath <> "" Then
                If IO.Directory.Exists(FolderBrowserDialog1.SelectedPath) = True Then
                    Me.curDir = FolderBrowserDialog1.SelectedPath & "/"

                    CreatePanels(getPictures(IPictures.SourceType.Local, Me.curDir))
                End If
            End If
        End If
    End Sub

    Public Function CreateIndexedList(path As String) As System.Collections.ArrayList Implements IPictures.CreateIndexedList
        Try
            If IO.Directory.Exists(path) Then
                Dim al As New ArrayList
                Dim dir As New IO.DirectoryInfo(path)
                Dim fi As IO.FileInfo

                For Each fi In dir.GetFiles()
                    al.Add(fi.FullName)
                Next
                Return al
            Else
                MsgBox("Path was incorrect.")
                Return Nothing
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
            Return Nothing
        End Try
    End Function

    Public Function getPictureCount(path As String) As Integer Implements IPictures.getPictureCount
        Try
            If IO.Directory.Exists(path) Then
                Dim i As Integer
                Dim dir As New IO.DirectoryInfo(path)
                Dim fi As IO.FileInfo
                For Each fi In dir.GetFiles()
                    i += 1
                Next
                Return i
            Else
                MsgBox("Path was incorrect.")
                Return Nothing
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
            Return Nothing
        End Try
    End Function

    Public Function getPictures(ST As IPictures.SourceType, Optional ByVal Path As String = "", Optional ByVal dbCon As OleDb.OleDbConnection = Nothing, Optional ByVal webAdd As String = "") As Image() Implements IPictures.getPictures
        Try
            If ST = IPictures.SourceType.Local And Path <> "" Then
                If IO.Directory.Exists(Path) Then
                    Dim i As Integer = 0
                    Dim dir As New IO.DirectoryInfo(Path)
                    Dim fi As IO.FileInfo
                    Dim im(getPictureCount(Path)) As Image
                    For Each fi In dir.GetFiles()
                        If fi.Extension = ".jpeg" Or fi.Extension = …
Begginnerdev 256 Junior Poster

Is the SQL Server install on the same PC or on the network?

Begginnerdev 256 Junior Poster

Are you using a data adapter?

Are you executing the adapter's Update function?

Begginnerdev 256 Junior Poster

Yes, this can be done with (intermediate) vb.net skills.

You will want to look into MySQL for a database backend.

Or, if you are wanting only one user, Acces will suffice.

You will want to sit down and start designing your GUI/Flowchart/Database

Design it to be practical and efficient.

Begginnerdev 256 Junior Poster

You can also do something like this:

Dim fromDir As New DirectoryInfo("C:\myFromDir\")'Import IO'
Dim toDir As String = "C:\myToDir\"
Dim fi As FileInfo


For Each fi in FromDir.GetFiles()
    File.Copy(fi.FullName,toDir & fi.Name)
Next

This will copy the file from the source to the destination with the same name.

Begginnerdev 256 Junior Poster

Are you selecting just one instance of the parameter "rate" or are you dealing with multiple entries?

If multiple, that might be your problem.

You can try passing all of this into a data table and looping through adding them to the label. (With delimiters "val1,val2,val3 ect...")

Begginnerdev 256 Junior Poster

Are you using SQL server's integrated security, or manually logging on?

Begginnerdev 256 Junior Poster

Ok, next question. Do you have a query that executes when your application exits?

Also, is your username/password checked against active directory when you first log in?

If so, there is your problem.

Begginnerdev 256 Junior Poster

Are you sure it is actually changing the value?

Write a small sub to go out and retrive the value as soon as it is changed.

Just tell the sub to get the username and pass where username = username

Then post that to a message box to verify it actually changed.

Call this right after the execnonquery before closing, just to verify it is actually executing.

Private Sub CheckIfChanged(username As String, YourConnection as SqlConnection)

    Dim sqlCom As New SqlCommand("SELECT username,password FROM userAccount WHERE username='" & username & "'", YourConnection)
    Dim da As New SqlDataAdapter(sqlCom)
    Dim ds As New DataSet
    Dim dt As New DataTable

    da.Fill(ds, "table1")
    dt = ds.Tables("table1")

    If dt.Rows.Count > 0 Then
        MsgBox("Username:" & dt.Rows(0).Item(0).ToString & " Password:" & dt.Rows(0).Item(0).ToString)
    End If

End Sub
Begginnerdev 256 Junior Poster

If your paragraphs are seperated by Crlf's, you can count the number of Clrf's between two sentences to determin a new paragraph.

You will have to read the character before the current character and possibly the character before that too.

You will want to do this by reading the file in character by character.

Begginnerdev 256 Junior Poster

What is your command text?

Do you have an update statement?

I am assuming that confirm user is returning true?
A function that checks to see if the user is in the database?

Begginnerdev 256 Junior Poster

Awesome, thanks Exception. I will give it a try.

Begginnerdev 256 Junior Poster

This may be what you are looking for.

Begginnerdev 256 Junior Poster

Hello my fellow Daniwebers.

I am to ask for some ideas for a challenge.

I want a good challenge for my skills, and even help expand my skills

Please post your challenge below.

Thanks,
Begginnerdev

M.Waqas Aslam commented: like the way to test your self , very good +4
Begginnerdev 256 Junior Poster

If you are not getting a reply - Don't make a new thread.

This would be your fourth thread on the same topic.

You can't beg community members for code, you have to show effort on your behalf.

I know people have posted usefull references numerous times, why have you not tried them?

Or, have you tried them and they have not worked?

If they have not worked, why not?

Begginnerdev 256 Junior Poster

I beleive you have chosen the wrong template for your thread.

Code snippets are mostly used for posting examples or contributing code to the community.

Also, I don't want to sound skiddish at all.....but what would you possibly want to hide a process for?

Are you writing a keylogger?

Are you writing a program for a"joke" on some one else?

Begginnerdev 256 Junior Poster

Another note, for the active - You can fill a context menu with the possible solutions and allow the user to click the one they want.