Displaying main report with subreport - vb.net

The following is my code and it is working with only one report.
rptbill = New CrystalReport1
rptexp = New ExpensesReport
rptmain = New MAINREPORT
rptbill.SetDataSource(dtincom)
rptexp.SetDataSource(dtexp)
frmCrystalReport.CrystalReportViewer1.ReportSource = rptmain
What I want is that my rptmain shows the field of my submenus rptbill and rptexp. I don't know how to get this to work.

Related

QGroupBox sizing with my QT5 custom widget

I am trying to make a custom widget: for displaying a processor register which has a name, a value and can be displayed in octal/decimal hexa. The code is shown at the bottom. I receive better result when I use the code as shown (i.e I insert QRadioButtons):
If I use
mainLayout->addWidget(DisplayMode);
instead (I guess this is the correct method) then the resulting picture is
Do I misunderstand something? What is wrong?
RegisterWidget::RegisterWidget(QWidget *parent)
:QFrame (parent)
{
mValue = 0;
mName = "";
setFrameStyle(QFrame::Panel | QFrame::Sunken);
QHBoxLayout *mainLayout = new QHBoxLayout(this);
label = new QLabel(tr("mName"),this);
label->setText(mName);
label->setLineWidth(2);
QGroupBox *DisplayMode = new QGroupBox("");
QRadioButton *OctalR = new QRadioButton(this);
QRadioButton *DecimalR = new QRadioButton(this);
DecimalR->setChecked(true); DecimalR->setDown(true);
QRadioButton *HexaR = new QRadioButton(this);
QHBoxLayout *hbox = new QHBoxLayout;
hbox->addWidget(OctalR);
hbox->addWidget(DecimalR);
hbox->addWidget(HexaR);
hbox->addStretch(1);
DisplayMode->setLayout(hbox);
mainLayout->addWidget(label);
Value = new QLCDNumber(this);
Value->setDigitCount(8);
Value->setSegmentStyle(QLCDNumber::Flat);
Value->display(mValue);
mainLayout->addWidget(Value);
/* mainLayout->addWidget(DisplayMode);*/
mainLayout->addWidget(OctalR);
mainLayout->addWidget(DecimalR);
mainLayout->addWidget(HexaR);
setLineWidth(3);
setLayout(mainLayout);
connect(OctalR, SIGNAL(clicked()), this, SLOT(setOctal()));
connect(DecimalR, SIGNAL(clicked()), this, SLOT(setDecimal()));
connect(HexaR, SIGNAL(clicked()), this, SLOT(setHexa()));
}
Call QLayout::setContentsMargins() for both mainLayout and hbox. Try (3, 3, 3, 3) as parameters for a starting point and tweak. Layouts have default margins of 11 pixels on most platforms, according to the docs.

Programmatically Creating Attributes - Prestashop 1.6

I am programmatically adding attributes to Prestashop 1.6 as follows:
$newGroup = new AttributeGroup();
$newGroup->name = $this->createMultiLangField('test');
$newGroup->public_name = $this->createMultiLangField('test');
$newGroup->group_type = 'select';
$newGroup->add();
$newAttribute = new Attribute();
$newAttribute->name = $this->createMultiLangField('test');
$newAttribute->id_attribute_group = $newGroup->id;
$newAttribute->add();
When I look in my catalog this attribute and its group are there and everything appears to be in order. However, when I click combinations on any of my products after doing this, the ajax loader spins out indefinately (I can no longer create combinations on ANY of my products). Has anybody experienced anything like this?
The code should be:
$newGroup = new AttributeGroup();
$newGroup->name = $this->createMultiLangField('test');
$newGroup->public_name = $this->createMultiLangField('test');
$newGroup->group_type = 'select';
$newGroup->add();
$newAttribute = new Attribute();
$newAttribute->name = $this->createMultiLangField('test');
$newAttribute->id_attribute_group = $newGroup->id;
$newAttribute->add();

vb - I am trying to print other form but this happens:

(this is my first post so correct me if I'm doing something wrong.)
Here is a bit of my code:
imp.id.Text = globalvars.mdataset.Tables("table1").Rows(0).Item("id")
imp.date.Text = globalvars.mdataset.Tables("table1").Rows(0).Item("date")
imp.hour.Text = globalvars.mdataset.Tables("table1").Rows(0).Item("hour").ToString
imp.PrintForm1.PrinterSettings.DefaultPageSettings.Margins = New Printing.Margins(10, 10, 10, 10)
imp.Show()
imp.Focus()
imp.PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
imp.PrintForm1.Print()
and what happens is that when it gives me the preview the page is empty... but the weird thing is that when i place a msgbox just before the printing action, the preview goes right and shows me what i want to print....
any tips?
EDIT: imp is the form where the printform is
Try to add this ..
....
Application.DoEvents
imp.PrintForm1.Print()

C# RDLC Reporting Error

I have writen code for to attach RDLC ReportViewer with a DataTable from a DataSet
But this error occurs: "A data source instance has not been supplied for the data source 'DataSet'."
aspx file code for Report Viewer
This is Report Viewer code
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
<ServerReport ReportPath="Analysis.rdlc" />
<LocalReport ReportPath="Hospital\Analysis.rdlc">
</LocalReport>
</rsweb:ReportViewer>
C# File Code
This is code to fill Rows of DataTable in DataSet
ArrayList columns = new ArrayList();
columns.Add("Temp");
columns.Add("Humidity");
columns.Add("Rain");
columns.Add("Mosquitos");
columns.Add("FloodArea");
columns.Add("CloudyWeather");
columns.Add("FlowerVases");
columns.Add("IndequateSanitation");
ArrayList data = new ArrayList();
data.Add(Temp.SelectedItem.ToString());
data.Add(Humidity.SelectedItem.ToString());
data.Add(Rain.SelectedItem.ToString());
data.Add(Mosquitos.SelectedItem.ToString());
data.Add(FloodArea1.SelectedItem.ToString());
data.Add(CloudyWeather.SelectedItem.ToString());
data.Add(FlowerVases.SelectedItem.ToString());
data.Add(IndequateSanitation.SelectedItem.ToString());
BayesAnalysis bAnlysis = new BayesAnalysis();
ArrayList result = bAnlysis.classifyD(DiseaseList.SelectedItem.ToString(), columns, data);
List<double> pn = bAnlysis.PosNum();
NormalAnalysis nAnalysis = new NormalAnalysis();
AnalysisDataSet dss = new AnalysisDataSet();
for (int loop = 0; loop < pn.Count; loop++)
{
dss.ReportData.AddReportDataRow(loop, result[loop].ToString(), nAnalysis.NoPatient(nAnalysis.GetDiseaseID("Dengue"), nAnalysis.GetCityID(result[loop].ToString())), nAnalysis.TotalPatient(nAnalysis.GetDiseaseID("Dengue")), nAnalysis.diseasePercentageInCity(nAnalysis.GetDiseaseID("Dengue"), nAnalysis.GetCityID(result[loop].ToString())), pn[loop]);
}
This is code to Give Data Source to the Report Viewer
DataTable dtt = dss.ReportData;
ReportViewer1.Visible = true;
ReportDataSource datasource = new ReportDataSource("Analysis",dtt);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasource);
ReportViewer1.LocalReport.Refresh();
Of the top of my head I think your line of code that says :
ReportDataSource datasource = new ReportDataSource("Analysis",dtt);
ReportDataSource datasource = new ReportDataSource("DataSet",dtt);
Basically it is to do with a name that you used in the RDLC file and when you supply the report dataset it must be named the sames.

VB.Net Image is not Showing at Runtime

Button image and icon is not showing at runtime
Button Image
Me.wibtnAdd.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton
Me.wibtnAdd.DisabledImagesGrayScale = False
Me.wibtnAdd.Enabled = False
Me.wibtnAdd.Image = CType(resources.GetObject("wibtnAdd.Image"), System.Drawing.Image)
Me.wibtnAdd.ImageFixedSize = New System.Drawing.Size(24, 24)
Me.wibtnAdd.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top
Me.wibtnAdd.Location = New System.Drawing.Point(53, 302)
Me.wibtnAdd.Name = "wibtnAdd"
Me.wibtnAdd.Shape = New DevComponents.DotNetBar.RoundRectangleShapeDescriptor(2)
Me.wibtnAdd.Size = New System.Drawing.Size(61, 52)
Me.wibtnAdd.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled
Me.wibtnAdd.TabIndex = 8
Me.wibtnAdd.Text = "Add"
Form Icon
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
to make your code more clear : 1) get rid of the 'Me'
2) use a 'With' clause
(i edited)
the issue seems to be in your access to resources : are you sure
you have a resource named "wibtnAdd.Image" ? it seems 'strange'
that it has same name as your object/property... Check your
wibtnAdd.Image, it might be Nothing. Same for your Icon.
Btw why not doing this in xaml ?? it would be much more readable,
and you can edit everything while seeing results.