Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Okay,

 

I have a data tier setup. My users selects what record they want to view with a combo box. I pass this information using a public variable and to a function in my datatier which returns a dataset with the appropriate details based on this variable. So far so good. Now I take this dataset and pass it to a local sub procedure which is suppose to bind some text boxes to data in the data set. The only thing is is that the textboxes remain blank.

 

I just tried to use a datagrid to see what is happening and although the proper column headers are there, the values are all coming up null.

 

Any ideas?

 

Chester

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

  • *Experts*
Posted

Sounds like you've either got no data in your dataset or however you're binding is off - both to the textboxes and the grid.

 

I'd first verify that the DataSet has the data you expect. The simplest way is to print out the value of ds.GetXml(). You can also write the DataSet to disk with ds.WriteXml().

 

Let us know if it has data but the binding's not working. Let us know what code you've got for the binding, too, so we can help tweak it (if it's off).

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Experts*
Posted

From the immediate window you can use:

?ds.GetXml()

where ds is the dataset.

 

In code you can put:

System.Diagnostics.Debug.WriteLine(ds.GetXml())

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

I get something that says: <dsPOInformation xmlns="http://www.tempuri.org/dsPOInformation.xsd" />

 

I also thin my problem may be in trying to pass my public module level variable from my form to my data class. I am trying to figure out how to do this. I was under the assumption that when you made a variable public that as long as the form is open then any other class or module could use it. Am I wrong in this assumption?

 

Chester

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

  • *Experts*
Posted

The line you show is basically saying you've got no data in your dataset, hence nothing to show up for binding.

 

I'd have to see some code in both the class the creates/returns the dataset and the class/form that calls it.

 

Why use a public variable? If you have a separate class made to return a dataset I would think you'd just pass in the value rather than use a public variable.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

I tried to pass the variable byval and it errored on me, but I will check into it.

 

This is my button click that calls the function: (some of the code is just my experimentation)

 

 

Private Sub btnGetPO_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetPO.Click

Dim intIndex, intIndex2 As Integer

Dim dsPOInformation As DataSet

Dim dv As DataView

 

 

If Me.cboReqNum.Text <> "" And Not mControlKey Then

'search for a matching entry

Dim MatchText As String = Me.cboReqNum.Text

Dim Match As Integer = cboReqNum.FindString(MatchText)

 

'if a matching entry is found

If Match <> -1 Then

mstrSelectedPO = MatchText

intIndex = mstrAddedPOs.IndexOf(MatchText)

If intIndex = -1 Then

intIndex2 = mstrAddedPOs.IndexOf("x, xx, xxx")

If intIndex2 <> -1 Then

mstrAddedPOs = mstrAddedPOs.Replace("x, xx, xxx", "")

End If

MatchText = MatchText.Insert(0, ", ")

mstrAddedPOs = mstrAddedPOs.Insert(0, MatchText)

 

dsPOInformation = mobjReqTrakInfo.getPOInfo()

dv = mobjReqTrakInfo.poDataView()

 

With DataGrid1

.DataSource = dv

'.DataMember = "table"

End With

Call bindDataFields(dsPOInformation)

 

Else

MessageBox.Show("This requisition is already included in the list. Would you like to remove it from the list?", _

"Attorney General", MessageBoxButtons.YesNo, MessageBoxIcon.Information, _

MessageBoxDefaultButton.Button2)

If DialogResult.Yes Then

mstrAddedPOs = mstrAddedPOs.Replace(MatchText, "")

End If

End If

Else

MessageBox.Show("Could not find a requisition number matching your request")

End If

Else

MessageBox.Show("Please select a requisition number to add")

End If

 

Me.cboReqNum.Text = ""

Me.btnAddPO.Focus()

 

End Sub

 

This is the function in my data class that gets the PO info:

 

 

Public Function getPOInfo() As DataSet

Try

DsPOInformation1.Clear()

'daPOInformation.SelectCommand.Parameters(0).Value = strParameter

daPOInformation.Fill(DsPOInformation1)

Catch err As Exception

MessageBox.Show(err.Message)

End Try

 

Return DsPOInformation1

 

End Function

 

Any ideas?

 

Chester

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...