How to use the method GetCellValue of GuiGridView - sap-gui

I wanna know how to use this method I found from the documentation of SAP GUI. But how do I use it?
Documentation from GuiGridView object:
Public Function GetCellValue( _
ByVal Row As Long, _
ByVal Column As String _
) As String
Returns the value of the cell as a string.
Could you provide me an example?

Related

Parallel one Optional AND one ParamArray in a sub

I'm not so professional in asp .net vs2012 vb, and now I've a problem:
This is the declaration of the sub:
Public Sub DocFill(ByVal DocName As String, ByVal Optional OK As Boolean=False, ByVal ParamArray BmValues() As String)
And the error message is:
Error 7 'BmValues' is not declared. It may be inaccessible due to its protection level.
I tried change the order, but the last value always drop this error
Is possible to declare soehow parallely this two params or not?
Thanks for the help!
A possible solution is to cook up something like this:
Public Sub DocFill(ByVal DocName As String, ByVal ParamArray BmValues() As Object) ' Declare BmValues as an array of Object.
Dim OK As Boolean = False ' Declare the OK Boolean within the method.
If BmValues.Length > 0 Then ' Check whether BmValues contains anything.
If BmValues(0).GetType() is GetType(Boolean) Then ' Check whether BmValues' first value is a Boolean.
OK = CBool(BmValues(0)) ' If so, set OK to the first value in BmValues.
End If
...
End If
...
End Sub

asp.net generic comparator for typed list

The formulation below won't work, because "p2.item(X)" is not a valid property or method.
How might I write this so that the comparator field can vary based on the sort key value; that is, use something like "p2.item(X)", maybe in Reflection.
Public Sub SortList( _
ByRef varList As List(Of GVDisplayRow), _
ByVal varSortKey As String, ByVal varSortSeq As String)
varList.Sort(Function(p1, p2) p1.item(varSortKey).CompareTo(p2.item(varSortKey))
End Sub
The alternative is to use a Select statement, much less elegant.

How can I pass a variable value from one sub to another

I am new to the programming world. I have got the chance to work and develop in a project built with vb.net and asp.net.
In my coding I have stored a value in a variable under one sub btn_Click(). I want to use that variable value from another sub - AddCategory(). Both are written under same class.
Protected Sub btn_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Dim sale = Guid.NewGuid().ToString()
Dim SaleID As String = sale
Core.DB.Insert("insert into survey(id,title, detail) values(#id,#title, #detail);", Core.DB.SIP("title", Title), Core.DB.SIP("detail", Detail), Core.DB.SIP("id", sale))
Call AddCategory1()
Response.Redirect("profile.aspx")
End
As you can see in the above code the ID value for sale table is a GUID value and I am converting into a string to store it one variable SaleID.
And you can also see I have called AddCategory1(). Now I want to pass the value of SaleID (string) into AddCategory(). And I want to do another insert query to category table under AddCategory()
Private Sub AddQuestionCategory1()
Core.DB.Insert("insert into SaleCategory(title, detail, saleid) values(#title, #detail, #sid)", Core.DB.SIP("title", CategoryTitle), Core.DB.SIP("detail", CategoryDetail), Core.DB.SIP("sid", sale))
End Sub
To be able to do so I have to pass the value stored under the variable SaleID.
How can I do that?
The usual way to pass a value to a method (Sub or Function) is to make it an argument. Set up the method to expect the SaleID as an argument and then call the method with that argument.
Private Sub AddCategory1(SaleID as String)
'You can use SaleID in your code
End Sub
Call this sub from your Click handler like this
AddCategory1(SaleID)

Object not queryable

I have a database "Pubs" with a table "authors". I have made a dbml file from the database by dragging over "authors".
Here is the "Default.aspx.vb"
Public Class _Default
Inherits System.Web.UI.Page
Dim author As Object
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim db As New PubsContext
Dim authors = From p In dbo.authors _
Select p
GridView1.DataSource = author
GridView1.DataBind()
End Sub
End Class
Here is the class for it: "Class1.vb"
Partial Public Class PubsContext
Dim authors As Object
Public Function GetProductsByCategory(ByVal id1 As Integer) As IEnumerable(Of authors)
Return From p In Me.authors _
Where p.au_id = id1 _
Select p
End Function
End Class
Error code:
"Expression of type 'Object' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ".
In references there is already a "System.Data.Linq". What should I do?
Well this is the problem:
Dim authors As Object
That's just an object. What does it mean to call Select, Where etc on that? Where are you even giving it a value? Work out what the type should really be, make sure you give it an appropriate value to start with, and you should be fine.
It's not clear why you're introducing your own authors field at all, to be honest - I'd expect the generated context to have an Authors property of type Table<Author> or something similar.
(I note that you're also trying to set GridView1.DataSource to author rather than authors, by the way... Why are you doing that? What value are you expecting the author field in _Default to have?)

Entity Framework - passing different object sets as a parameter in a function

I have the following code:
Private Sub setDropdowns()
Using licensingModel As New licensingEntities
SetUpDropdowns(licensingModel.tblLookup_Country, "CountryName", "CountryName", country)
SetUpDropdowns(licensingModel.tblLookup_Country, "CountryName", "CountryName", bizCountry)
SetUpDropdowns(licensingModel.tblLookup_Salutation, "SSalutation", "SSalutation", salutation)
SetUpDropdowns(licensingModel.tblLookup_OrgType, "OrgType", "OTAuto", organisationType)
End Using
End Sub
and the sub SetUpDropdowns:
Private Sub SetUpDropdowns(ByVal entity As IObjectSet(Of EntityObject), ByVal textColumn As String, ByVal valueColumn As String, ByVal combo As RadComboBox)
combo.DataSource = entity
combo.DataBind()
End Sub
My problem is that i dont know how to define the parameter type for the sub. Because they are different types of objectSets being passed each time, I thought IObjectSet(Of EntityObject) would work, but it gives me the following error:
Unable to cast object of type 'System.Data.Objects.ObjectSet1[licensingModel.tblLookup_Country]' to
type
'System.Data.Objects.IObjectSet1[System.Data.Objects.DataClasses.EntityObject]'‌
Would anyone have a solution for this?
can you not just use object as your parameter?

Resources