What am I doing wrong?



  • 1. Context Menu Size.
    Hi everyone, Please I'm creating a Context Menu and doing a manual Show from C#, on a different thread I need to know the window size of the Context Menu already opened, I have the object created and I have the reference to it, and I have the handle, but I cannot get the window information. .Net Context Menu doesn't offer nothing to get this info. I tried calling the Window API GetClientRec and GetWindowRec sending the handle to the context menu, but it always return 0. I don't know how can I get the information to that window, basically I need location and Size. I'm kind of hurry with it. Please if you know let me know. Thanks, Gustavo.
  • 2. VB6 to VB.NET Migration - MAPI
    Hi, I am at last starting to migrate my VB 6 programs to VB.NET 2003 and have a hit a problem... The upgrade wizard produces the following error message and then aborts: "The referenced components MAPIMessages MAPISession are missing design time licenses." I can find no reference to this message in the Visual Studio Help or in the online knowledge base. Any ideas how to get round the problem? I am using the Microsoft Development Environment 2003 Version 7.1.3088 JPL
  • 3. Working with TCPclient
    Hi! Trying to get my head around working with network connectivity in VB.Net. I've gotten a fairly decent control based on the sample in the 101VBSamples available from Microsoft.What I'm having problems with is the GetStream.BeginRead method. Problem is that it's all one way... My application connects and is able to send data, but I don't have much in the way to provide realtime data back from my control Is GetStrem.BeginRead method a line based method? i.e. Does it wait for the CR/LF before it fires the delegate to read the buffer? Is there a character based equivilent method? How about being able to fire the delegate whenever there is any data at all in the buffer? Basically, I want to watch the data stream for specific strings and fire an event when they happen. I also want to have a realtime input buffer that doesn't depends on a CR/LF to add data to the buffer. Any help is appreciated!

What am I doing wrong?

Postby cjobes » Mon, 06 Dec 2004 08:55:47 GMT

Hi all,

The code below is part of a form where I would like the user to make
selections from a table. The data is brought into the form from another form
Public WriteOnly Property DataSet() As DataSet
    Set(ByVal Value As DataSet)
        ResultGrid.DataSource = Value.Tables("tbSelect")
    End Set
End Property

When the user clicks on a button "New Filter" the code below runs. On the
line "ResultGrid.DataMember = "tbTemp" the execution stops with the
following error: "Can't create a child list for field tbTemp"

Private Sub btNewFilter_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btNewFilter.Click
    Dim uSelect As String = "cindih"
    ResultGrid.Visible = False
    Dim strSearch As String = "user='" + uSelect + "'"
    _dt = ResultGrid.DataSource
    Dim tbTemp As DataTable
    tbTemp = _dt.Clone()
    Dim dRows() As DataRow = _dt.Select(strSearch, "")
    Dim drSel As DataRow
    For Each drSel In dRows
        If Not drSel("hours") Is System.DBNull.Value Then
            totHours = totHours + drSel("hours")
            drSel("hours") = 0
        End If
    ResultGrid.DataMember = "tbTemp"
    ResultGrid.Visible = True
End Sub

What am I doing wrong here?


RE: What am I doing wrong?

Postby Q2hhcmxpZQ » Mon, 06 Dec 2004 14:43:01 GMT

Replace the line:  ResultGrid.DataMember = "tbTemp"
with:   ResultGrid.DataSource = tbTemp

If the DataSource of a DataGrid is a DataTable, just set the property 
directly to the Datatable.

If the DataSource of a DataGrid is a DataSet, then you can specify which 
table in the DataSet you want to display using the DataMember property.  The 
TableName property for the DataTable within the DataSet would have to be set 

DS.Tables(0).TableName = "DT"


Re: What am I doing wrong?

Postby cjobes » Mon, 06 Dec 2004 15:13:01 GMT


You don't have any idea how grateful I am for your answer. I don't know how
many hours I have been trying to figure this one out. MSDN wasn't helpful

Thanks again,




Re: What am I doing wrong?

Postby Cor Ligthert » Tue, 07 Dec 2004 00:57:23 GMT


The problem with most samples from MSDN is that they are with strongly typed
dataset and with let say raw datasets.

I mostly use in all my samples raw datasets. However because you started to
make a strongly typed dataset I went on that route. In the way I showed you
that sample, you can forever use the top reference of that strongly typed
dataset, therefore something as

ds.tables("KlausTable") in a table in the dataset while when you make it
strongly typed yuursel fit can be ds.KlausTable

a reference to a table can forever been set as
dim myTableRef as datatable = ds.tables("KlausTable")

I hope this gives some ideas.


"cjobes" < XXXX@XXXXX.COM >

Re: What am I doing wrong?

Postby Larry Serflaten » Tue, 07 Dec 2004 03:21:17 GMT

"Cor Ligthert" < XXXX@XXXXX.COM > wrote

(you can always use the top reference)

(a table can always be set as)

Since you provide so many answers, it will be a big help
if we can slowly help you to post fluent English!  :-)

Always - is conditional (in all ways..., at all times...,  in all cases... etc.)
Forever - is a never ending expanse of time

While humans must always breathe, no one breathes forever.
These newsgroup posts always get copied to the Google
archive and may be forever available to everyone.


Re: What am I doing wrong?

Postby Cor Ligthert » Tue, 07 Dec 2004 18:36:32 GMT


I will keep an eye on it, my dictionary gives for both almost the same 
translation word, in transslated words "all times" (still and will be) and 
for ever  = "all times" (start and endless). While the say that forever is 
the same as ever.

However I will try to keep an eye on it.

The samples are clear, to translate them checking

Always   continuing as long as is
Forever  a fact



Re: What am I doing wrong?

Postby Cor Ligthert » Tue, 07 Dec 2004 21:06:50 GMT


While *they* say that forever is  the same as "ever".
Only a typo.

By the way before you misunderstood this, "always" an "forever" is 
translated as "altijd" in Dutch "al" = English "All" and "tijd" = "time".

Again thanks.


Re: What am I doing wrong?

Postby cjobes » Fri, 10 Dec 2004 07:59:21 GMT

Hi Cor,

Guess I have figured out what neck of the woods you are in. Where in Holland
are you?

I'm in your Neighbourhood next week (France and Germany) with plane changes
in Amsterdam and Paris.


Re: What am I doing wrong?

Postby Cor Ligthert » Fri, 10 Dec 2004 17:08:52 GMT


Claus, interesting, I am almost true in the woods of Holland yes (and there 
is not much wood here).

Amsterdam and Paris are my favorite places so I can only tell you that that 
cannot be a bad idea.

Nightlive, culture
Culture, shoping

There are a lot of other good places in Europe, however those two above are 
my favorites.

However a little bit of object here these messages



"cjobes" < XXXX@XXXXX.COM >

What am I doing wrong?

Postby Robert Dufour » Sun, 10 Jun 2007 07:25:18 GMT

I have two classes , class1 and class2

In class1 I have

Public Overload function Fct1(paramlist) as string
    some code
end function

Public overloads Function Fct1(otherparamlist) as string
    some code
end function

In class2 I have

Private sub use fct1
    Dim str as string
    str = class1.fct1(paramlist)
end sub

In the IDE fct1 in class two shows an error reference to a non-shared member 
requires on object reference

What am I doing wrong? Can anyone point me in the right direction?

Thanks for any help.

Re: What am I doing wrong?

Postby Mr. Arnold » Sun, 10 Jun 2007 08:24:45 GMT

 http://www.**--****.com/ (vs.80).aspx

You use the Shared keyword. You can further look it up use Google.

where you can do str = class1.fct1(paramlist)


You have to instantiate and object to set reference.

dim cls1 = new class1

str = cls1.fct1(paramlist)

Re: What am I doing wrong?

Postby Robert Dufour » Wed, 13 Jun 2007 06:01:37 GMT

I am using 2005, the code worked in 2003 but now it fails when imported in 
I guess they "improved" some some fundamentals again <GGGG>


Re: What am I doing wrong?

Postby Phill W. » Wed, 13 Jun 2007 21:16:36 GMT

Both Fct1()'s are /Instance/ methods - you need to create an instance of 
the class that defines them before you can use the methods.

Private Sub Use_fct1()
    Dim c1 As New Class1
    Dim s2 As String _
       = c1.Fct1(...
End Sub

Compare this to the IndexOf() on the String class - in order to search 
one string for another, you have to start with the string you want to 

Dim s1 As String = "abcdefghijklmnop"
Dim i1 As Integer = s1.IndexOf( "d" )

To use the syntax you started out with, you have to make the methods 
"Shared" (you'll see "Static" in C# examples).

Class Class1
    Public Shared Sub fct1( ...

then you can do this:

Private Sub Use_fct1()
    Dim s2 As String _
       = Class1.fct1(...
End Sub

Compare this to the Join method on the String class.  You can use 
any-old string to join a string array using a delimiter you don't need a 
/specific/ string, so /any/ of these will do:

Dim s1() As String = ...
Dim s2 As String

' Use the class name directly
s2 = [String].Join( vbCrLf, s1 )

' Instances get (inherit) all the Shared methods as well
s2 = s2.Join( vbCrLf, s1)

' And, even more strangely ... :-)
s2 = "fred".Join( vbCrLf, s1)

    Phill  W.

Similar Threads:

1.What am I doing wrong??

Here is what I am trying:

\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)
\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,

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


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

            Dim strConn As String
            strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data 

            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)
        End Try
    End Sub

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

        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.




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

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?


4.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)
        DB.Fill(ES, "Contact")

        If ES.Tables("Contact").Rows.Count > 0 Then
            txtAddress.Text = 
            txtFirst_Name.Text = 
            txtLast_Name.Text = 
        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

            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
            DB.Update(ES, "Contact")

        Catch ex As Exception


        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?



5.Newbe question, What am I doing wrong

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.

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

6. Programatically getting a RichTextBox to scroll - 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 39 guest