cancel
Showing results for 
Search instead for 
Did you mean: 

How to update UserField?

leon_laikan
Participant
0 Kudos

Hi,

I am working on a grid, and am using VB.NET.

The picture below shows what I want to achieve.

I found an answer here:

And here is my code, which is an adaptation of the above thread:

'// If TYPE = GRPO

                    If oOPDN.GetByKey(oDocEntry) Then

                        oOPDN.UserFields.Fields.Item("U_HandOver").Value = "Y"

                        oOPDN.UserFields.Fields.Item("Seq").Value = oValue    <---  How to dim oValue?

                        retVal = oOPDN.Update

                        ....

                       .....

My Question:

The Update works for "U_HandOver", but not for "Seq" because I have not dim "oValue"

How to declare oValue?

Thanks

Leon Lai

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Leon,

As you said you are using Grid, oValue should be oGrid.DataTable.GetValue("Seq", RowNumber).ToString()

You can convert it the desired DataType. So it should be like this:

for (int k = 0; k <= oGrid.Rows.Count - 1; k++)

{

     string IsSelectedHandOver = oGrid.DataTable.GetValue("U_HandOver", k).ToString();

     string SEQ = oGrid.DataTable.GetValue("Seq", RowNumber).ToString();

     string Type = oGrid.DataTable.GetValue("TYPE", RowNumber).ToString();

     if (Type == "GRPO")

     {

                           If oOPDN.GetByKey(oDocEntry) Then

                             oOPDN.UserFields.Fields.Item("U_HandOver").Value = "Y"

                             oOPDN.UserFields.Fields.Item("Seq").Value = SEQ    <---  I am assuming SEQ is of Alphanumeric Type

                             retVal = oOPDN.Update

     }

}

Hope it helps.

Thanks & Regards

Ankit Chauhan

leon_laikan
Participant
0 Kudos

Hi Ankit

Thanks for your reply.

I am trying to convert your C# code into VB.NET, but my converter is running indefinitely.

I don't know if it's a problem with my converter or your code.

I only need this code:

oValue = oGrid.DataTable.GetValue("Seq", RowNumber).ToString()



Please rewrite  it  correctly in VB.NET for me. So I can test it.


I tried the below, but it does not work:

Dim oValue As Integer = oGrid.oDataTable.GetValue("Seq", pVal.Row)




Best Regards,

Leon

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Leon,

Try it as follows:

For i As Integer = 0 To oGrid.Rows.Count - 1

Dim oValue As String = Convert.ToString(oGrid.DataTable.GetValue("Seq", i))

-- Dim ItemCode As String = Convert.ToString(oGrid.DataTable.GetValue("Item Code", i))

Hope it helps now.

Thanks & Regards

Ankit Chauhan

leon_laikan
Participant
0 Kudos

Hi Ankit,

Now it works fine!

Best Regards,

Leon Lai

Answers (0)