vb.net data set not working - visual-studio-2010

I am using two different datasets to populate datagridview my project using visual studio using vb.net. It is windows forms application which is used to display information from the database based on user inputs. Once the information is displayed the user can save the information into a table specifically created to store the report information in order for it to be recalled at a later date. I am now trying to recall this information so have created my dataset in the same way as before and am now trying to invoke a new occurrence of it and this is where the probelm begins. The code is below.
Dim dv2 As New System.Data.DataView
dv2 = New System.Data.DataView(DataSet2.Tables(0), "Status <> ''", "",
DataViewRowState.CurrentRows)
DataTable2TableAdapter.fill(DataSet2.DataTable2, f5.ComboBox2.SelectedValue)
I am getting two issues.
For DataSet2.Tables(0): Reference to a non-shared member requires an object reference
For DataTable2TableAdapter: ’DataTable2TableAdapter’ is not declared. It may be inaccessible due to its protection level.
I dont know why this is happening as I have written the same code here as for my previous data set other than changing the SQL statement behind the dataset at set up. Any thoughts would be welcome as I am totally out of ideas. All questions are welcomed.
Thanks

Try the following code to fix your error number 1....
Dim tablezero as System.Data.DataTable
'
tablezero = DataSet2.Tables(0)
The reason your getting the error is because you are trying to access an object (Table(0)) and it is not visible to the code that is trying to access it, if it was SHARED then it would be visible.
So you can resolve it by defining and object instance/reference to it and then accessing that reference, which in this case i have called "tablezero" (or by making table(0) SHARED - usually not the best bet unlessits neccesary - no point in having something accessible to the whole class it is declared in unless absolutelty neccessary)
It is quite possible the second error may dissapear after just fixing above, then again its difficult to tell without your code for Dataset2
Hope it helps.

Related

swift : display info to a users (first use) and then disappear

I would like to display some info on the screen ... which will disappear.
Example : an Uiview is displayed for the first time to an user (or feature never used by the user). I would like to display on a screen a label or an image to explain how to use this new feature. After that it will disappear ...
If this functionality has already been used by the user, the message is ofcourse not displayed.
example of message --> to add a gamer, press +
How to do that ? a lot of apps have this kind of help.
thanks
What you have to do is actually very simple : have a persistent variable, and change its value. Each time the user could see the help popup, you check the value of the variable you stored persistently. If this variable indicates that the user have already seen the help, you don't display it again. Otherwise, you show it. Simple example:
let helpSeen: Bool = getVarFromPersistent()
if helpSeen == false {
// DISPLAY THE HELP MESSAGE OR POPUP
setHelpSeenVar(true)
}
Where getVarFromPersistent() and setHelpSeenVar() are function you could create to respectively retrieve the variable from the persistent data and set the variable in the persistent data.
Now, you have to figure out how to use persistent data. You can have a look at CoreData, that is provided by Apple and "ready to use" in Xcode. You've probably already seen the use core data tickbox when you create a project.
Third party libraries exists as well like RealmSwift, who reached version 1.0 recently.
I'm not an expert, but I think Realm is simpler to use than Core Data. The technology used by the two libraries could be different though, maybe someone else could tell you more about it. Anyway, you will find a lot of article about Realm and Core Data on Google.

How to recover from : Workflow Designer encountered problems with your document

As a novice with workflows I create a workflow (in VS2010 workflow designer) with a sequence within which I have a writeline activity. I am experimenting with creating arguments for the workflow so I create 2 arguments in the argument pane w/o doing anything with them at the activity level. (Noteworthy that I dont have a grasp of how to use arguments in the workflow yet). However I save my workflow while the workflow does not show any visible errors( red circles with an excalmation mark). Next time I open the workflow I get the error :
Workflow Designer encountered problems with your document .
Please check the document for invalid content, namespaces,references, or reference loops.
And that seems so final because there is no way that I can have access to my original workflow to possibly correct my error (whatever they might be). when I click on the detail down arrow I see this: Could not find member 'a' in type _8684 .
a is one of the two int32 arguments that I had in the workflow but which I never used in any of the activities.
I would appreciate any help. Thanks in advance.
It seems you're trying to re-host your Workflow Designer and it's not generating correct XAML for you.
The error Could not find member <mname> in type <tname> commonly occurs if the Workflow Designer instance is directly loading a container activity (sequence, flowchart etc.) instead of using an ActivityBuilder first.
If you're already using an ActivityBuilder then you may have missed giving it the root activity namespace. The correct way to add System.Activities.Presentation.WorkflowDesigner is:
this.workflowDesigner = new WorkflowDesigner();
this.workflowDesigner.Load(new ActivityBuilder { Implementation = new Sequence(),
Name = "RootNamespace.RootActivity" });
With the Name set properly WF designer would stop using random types (like _8684 in your case) and generate correct XAML on save/serialization. This should help you get rid of the namespace errors.

Getting new PurchId via .NET BusinessConnector

I am trying to find a .NET BusinessConnector equivalent call for the below line:
PurchId = NumberSeq::newGetNum(SalesParameters::numRefSalesId()).num();
I am manually entering purchase order information into the purchase order table, which is fine, but the problem lies in the fact that it is the PurchID that ties purchase table (PURCHTABLE) and the individual purchase order lines (PURCHLINE) is the PURCHID field, which is not automatically populated when saving a purchase order.
Currently I am:
ax.TTSBegin();
axRecord.set_Field("ORDERACCOUNT", purchaseOrder.OrderAccount);
(etc)
axRecord.Insert();
However, while this will insert a record into the database, it has no purchID, which has to be generated. You need a purchID to link the purchase line items in. I found the above code (second line) for X++, but does anyone know of a .NET BusinessConnector call that can be used instead?
Any assistance would be greatly appreciated.
Regards,
Steve
I would go for a change in the insert() method of the PurchTable table:
if (!purchTable.PurchId)
purchTable.PurchId = NumberSeq::newGetNum(purchParameters::numRefPurchId()).num();
Placed after the ttsbegin.
This to avoid complicated C# code. You probably could do it in C# code alone using CallStaticClassMethod and cousins, but it is better do put the buisness logic on the X++ side.
See How to: Call Business Logic Using .NET Business Connector.
Be sure to execute inside a TTSBegin/ TTSCommitblock, otherwise you will get error error messages like this one.
// ax is a reference to an "Axapta" business connector object
var numRef = ax.CallStaticRecordMethod("SalesParameters", "numRefSalesId");
var numSeq = (AxaptaObject)ax.CallStaticClassMethod("NumberSeq", "newGetNum", numRef);
var purchId = numSeq.Call("num");

How to add components in to an existing GUI created by guide?

I just created a GUI using guide in MATLAB for a small project I'm working on. I have amongst other things two text fields for from and to dates. Now I'd like to get rid of them and use a Java date select tool. Of course this is not possible using guide so I need to add them manually.
I've managed to get them to show up by putting this code into my Opening_Fcn,
uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
using UICOMPONENT.
But even though it shows up I can't access the date select's attributes, for example
get(handles.til2)
returns
??? Reference to non-existent field 'til2'.
How can I fix this?
Unless you edit the saved GUI figure, the basic handles structure will not include your new component by default.
One way to access you component is to store the handle via guidata, by adding the following to your opening function:
handles.til2 = uicomponent(handles, 'style','com.jidesoft.combobox.DateChooserPanel','tag','til2');
guidata(hObject,handles)
Functions that need to access the handle need the line
handles = guidata(hObject)
to return the full handles structure that includes the filed til2

Getting a blank data report vb6

I am new to vb6. I am working to create the invoice generation application. I am using data report to show the generated invoice.
The step by step working of process is:
Entering the data in to Invoice and ItemsInvoice tables.
Then getting the maxId using (Adodc) from the data base to show the last generated Invoice.
Then passing the max Id as parameter to the data report which is showing the invoice according to the invoice id.
It is working fine when I first time generate invoice. Now for 2nd invoice without closing application I am getting a blank data report. For data report I am using dataenvironment.
I am guessing the reason the data report is blank is because there was no record for that Id, but actually the record is inserting in the database.
What is going wrong?
I'm not sure how your data set is getting configured, but it sounds like you have a single record in the data and aren't reloading it properly. If your report is manually moving through the recordset and only showing info based on the ID parameter you are passing it and then using the same recordset for the second report, you probably just need to MoveFirst on the recordset to put it back at the beginning.
Load the data environment and refresh the data report.
I am also generating report in the similar fashion. I faced this problem. Here's the solution
Load DataEnvironment1
With DataEnvironment1
'Command1 is the command added to data environment where you fire query or
'set it to point to a table
If .rsCommand1.State <> 0 Then .rsCommand1.Close
.Command1 maxid 'parameter you pass to the recordset
End With
DataReport1.Refresh
DataReport1.Show
Thats it!
You are done. I m sure it will work. Do tell me if it doesn't.
I don't know if the answer will still bother you, but if someone else have the same problem here is a example of how the problem works:
Imagine that there is a gate and a guard looking who is entering, when the first person (the first invoice) comes, the guard registers him, opens the gate (This is the event "Load DataEnvironmet") and then lets the guy pass. The guard believes that no one else would come and lets the door open (the instruction believes that the DataEnvironment ends and the value EOF becomes True), but when the second guy comes (the second invoice) the guard can't ask him who is (has, again, the value and lets it pass without registering him (this is the reason why the second invoice, and subsequent in while invoice would come blank). The solution is to close the gate ("Unload DataEnvironment") after a guy passes (After showing the data report).
The solution is the code given from Sangita above, but just before ending the sub you need to unload the DataEnvironment you were working on.
For me, it works. Sorry if the answer is not what you were looking for (and also if someone else can't understand what I'm writing, my English isn't very good). Just in case I will write the code with the solution
Load DataEnvironment1
With DataEnvironment1
If .rsCommand1.State <> 0 Then
.rsCommand1.Close
End If
.Command1 Value(ID)
End With
DataReport1.Refresh
DataReport1.Show
Unload DataEnvironment1
Try a refresh method like data1.recordset.requery or
Data1.refresh. This should work if you use data controls.

Resources