What am I doing wrong??

VB.NET

    Next

  • 1. Hiding items in base classes
    If I have a Class "B" that Inherits Class "A", and my application uses class "B", is there a way that I can keep from exposing properties, subs, and events in the Class "A" base class from the application? For example, if Class "A" has a "StateChanged" event that I don't want the application to see, is there a way to hide exposure to that event in Class "B"? Thanks for any help. -Jason
  • 2. Visual Basic .Net List Box
    I am having a problem with a list box on a form. I have a list box that when I add items to it the text does not show up in the list box. I know thy are added because the side scroll bar changes and I can scrolll throught the list box. I can not figure out why the items are not being displayed. I have checked that the background color and the text color are different. Please let me know what else could be wrong
  • 3. how to submit a form when enter is pressed
    RTT, Set Form1.AcceptButton to the button you want clicket when enter is pressed.
  • 4. breakpoint in vb.net
    Can someone pls help me to solve this problem. Thanks in advance. After adding a breakpoint to a line of coding, the whole line turned red and there is a big red dot next to it. However if I run the program, a question mark appeared inside the big red dot with a message of "The breakpoint will not currently be hit. No symbols have been loaded for this document" and the program simply pass this breakpoint without stopping. Pls help!!

What am I doing wrong??

Postby Jason » Sat, 20 Sep 2008 05:16:55 GMT

Here is what I am trying:

My.Computer.FileSystem.CopyFile("\\server\all\sets\!!!!!PREFS
\Application Data", _
"C:\Documents and Settings\" & Environment.UserName & "\Application
Data\Adobe", True)
        MessageBox.Show("Done Resetting Application Data, Press OK to
Continue and reset Local Settings data", "Backup in progress...",
MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
        My.Computer.FileSystem.CopyFile("\\server\all\sets\!!!!!PREFS
\Local Settings", _
"C:\Documents and Settings\" & Environment.UserName & "\Local Settings
\Application Data\Adobe", True)
        MessageBox.Show("Done Resetting Local Settings data, Press OK
to Continue.", "Backup in progress...", MessageBoxButtons.OK,
MessageBoxIcon.Information)

I get the error that: \\server\all\sets\Application Data  is not
found, but it is there, and inside that folder I want to copy a folder
to c:\doc and set\user\application data\adobe

Also, will this work like this, one statement after another to do two
things?

thanks

Re: What am I doing wrong??

Postby Family Tree Mike » Sat, 20 Sep 2008 08:01:46 GMT

But yoru code refers to \\server\all\sets\!!!!!PREFS\Application Data.







Re: What am I doing wrong??

Postby James Hahn » Sat, 20 Sep 2008 08:29:10 GMT

It appears that "\\server\all\sets\Application Data" is a folder.  The 
message is probably saying something like "File does not exist : 
\\server\all\sets\Application Data, which is correct, as there is no such 
file.

You can't use FileSystem.CopyFile to copy a folder - use CopyDirectory 
instead.

Extending statements over multiple lines works, but can be avoided by 
setting a variable to the folder/file names first and using the variable 
instead of a literal in the statement.  This makes your code much easier to 
develop and test.  You can alsways get rid of the extra variables after 
everything is working OK.







Re: What am I doing wrong??

Postby Jason » Sat, 20 Sep 2008 08:32:25 GMT

What?

On Sep 18, 7:01爌m, "Family Tree Mike"






Re: What am I doing wrong??

Postby Jason » Sat, 20 Sep 2008 08:33:59 GMT

Oh yes, I forgot the !!!!PREFS part on the error message, I did that
part by hand and not a copy/paste









Re: What am I doing wrong??

Postby Family Tree Mike » Sat, 20 Sep 2008 11:01:46 GMT

The code in your message has extra stuff "!!!!!PREFS" in the path.  I'm 
trying to
clarify whether you pasted wrong, or whether you overlooked the obvious.





What?

On Sep 18, 7:01 pm, "Family Tree Mike"






Similar Threads:

1.What am I doing wrong - Trying to update

I have enclosed the sample code that I created.  I want to read in employee 
data, and modify a few fields.  I have tried to globally declare the objects 
that I need but I still am having problems.  I want to update in a seperate 
subroutine and seem to have problems.  HELP please.

-------------------------------------------
Public Class Form1

    Inherits System.Windows.Forms.Form
    Public cn As OleDb.OleDbConnection
    Public ds As DataSet
    Public da As OleDb.OleDbDataAdapter
    Public rowEmployee As DataRow

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load

        Try
            Dim strConn As String
            strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=C:\adonetsbs\SampleDBs\nwind.mdb;"

            Dim cn As New OleDb.OleDbConnection(strConn)

            Dim strSQL As String
            strSQL = "SELECT EmployeeID, FirstName, LastName, Address, City, 
Region, " & _
                "PostalCode from Employees ORDER BY LastName, FirstName"

            Dim da = New OleDb.OleDbDataAdapter(strSQL, strConn)
            Dim ds As New DataSet

            da.Fill(ds, "Employees")

            Dim tbl As DataTable = ds.Tables(0)

            'rowEmployee = New DataRow
            rowEmployee = tbl.Rows(0)
            txtFirstName.Text = rowEmployee("FirstName")
            txtLastName.Text = rowEmployee("LastName")
            txtAddress.Text = rowEmployee("Address")

        Catch ex As Exception
            MessageBox.Show(ex.Message & " :: " & ex.Source)
        Finally
        End Try
    End Sub

    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnUpdate.Click
        Try
            rowEmployee("LastName") = txtLastName.Text
            da.Update(ds)

        Catch ex As Exception

            MessageBox.Show(ex.Message & " :: " & ex.Source)

        End Try

    End Sub
End Class
---------------------------------------

When it runs I get the following error:

"Object reference not set to an instance of an object."

on the             da.Update(ds)       line in the btnUpdate_Click routine.

HELP.

Thanks,

Gary


2.Project build problem - what am I doing wrong?

I have a program that needs to access a prewritten external data file
that is supplied with the program. I want to place this data file in
Environment.SpecialFolder.LocalApplicationData\MyProgramFolder\

In the program's setup project I've done: Add Special Folder | User's
Application Data File, then within this created a folder called
MyProgramFolder, then Add File and pointed to a copy of my external
data file, which duly appears in the folder contents (EXCEPT that it
has a wavy line underneath!)

But unfortunately the resulting setup program does not install the
external data file where it should - in fact as far as I can see it
does not install it at all anywhere on the target PC.

Cany anyone advise what I'm doing wrong please? The fact that the file
entry has a wavy line underneath is presumably indicative of an error
but what's the cause and how do I fix it?

JGD

3.Table doesn't update - What am I doing wrong?

I have a form that has three textboxes on.  I want to be able to modify the 
FirstName, LastName, and Address

Here is the code to load the data
----------------------------------------------------------------------------
   Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load

        Dim strSQL As String = "Select * from Contact where sysid = '" & 
g_sysID & "'"
        DB = New SqlClient.SqlDataAdapter(strSQL, CN)
        ES.Clear()
        DB.Fill(ES, "Contact")

        If ES.Tables("Contact").Rows.Count > 0 Then
            txtAddress.Text = 
ES.Tables("Contact").Rows(0).Item("con1_02_03")
            txtFirst_Name.Text = 
ES.Tables("Contact").Rows(0).Item("First_Name")
            txtLast_Name.Text = 
ES.Tables("Contact").Rows(0).Item("Last_Name")
        End If

    End Sub
--------------------------------------------------------------------------
Here is the code to update the table
--------------------------------------------------------------------------
   Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnUpdate.Click

        Try
            es.Tables(0).Rows(0).Item("First_Name") = txtFirst_Name.Text
            es.Tables(0).Rows(0).Item("Last_Name") = txtLast_Name.Text
            es.Tables(0).Rows(0).Item("con1_02_03") = txtAddress.Text
            ES.AcceptChanges()
            DB.Update(ES, "Contact")

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub
-----------------------------------------------------------------
Why doesn't the table update?  Can anyone give me an explanation and also if 
I need to change code, please tell me where to put the modifications?

Thanks,

Gary


4.Newbe question, What am I doing wrong

Hi,
I have two questions the first is: in the example below how can I call
an event from within a statement, such as replace Stop1 with cmdStop1
which is a button on my form?
My second question again deals with the example below. Shouldn't I see
the valve of " i" counting away in the  txtCount1 text box? I don't
see anything in the text box and would like to know what I'm doing
wrong. Thanks in advance for any and all help.
Regards,
Ken



 Stop1 = 0
        Do
            For i As Integer = 1 To 10
                txtCount1.Text = i
                If Stop1 = 1 Then
                    Exit Do
                End If
            Next i
        Loop
    End Sub

5.Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Ive been working on this since yesterday and its bugging me. Although the
event is firing, The box does not scroll. Can anyone see what Im doing
wrong. I suspect it is stupidly simple.



TIA



SubClass RichtextBox in order to fire the OnVScroll Event

Public Class MyRichTextBox

Inherits RichTextBox

Public Sub PerformVScroll()

MyBase.OnVScroll(EventArgs.Empty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

RTB.PerformVScroll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RTB.VScroll

Console.WriteLine("Handling scroll")

End Sub




-- 
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.



6. What am I doing wrong?

7. What am i doing wrong?

8. What am I doing wrong?



Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 14 guest