ReportViewer: Two rldc files with same DataSource - c#

I have a report working fine, but now I need develop the same report in other language (english btw).Same layout, same fields.
So I created another .rdlc file and other winform (Maybe it's possible use the same winform, I saw something like that on my research)
My problem is:
After I set all fields and layout, when I select .rdlc file on "choose report" in ReportViewer and do the same way I was doing. Something isn't right because I not getting all BindingSource and all TableAdapter automatically.
On .rdlc file I add all DataSet from DataSource that I was needing.
I Try add manually the TableAdapter from Toolbox because it's showing all components from the other report, but doesn't work.
What is the best way to do something like that? two rdlc file with same data, same DataSource.
I'm thinking create another DataSource file (.xsd).
(sorry my english)

Same data but different languages? Try this:
use a single RDLC file with a boolean parameter like blnEnglishLanguage
for every TextBox used as label set an expression like this: =IIf(Parameters!blnEnghlishLanguage.Value, "Item", "Articolo")
BONUS: give a look at this link to localize your form:
see accepted answer and the answer provided by noelicus.

what i have don is.
you need to set a parent window to IsMdiContainer = true.
and then you can open the windows forms with the report in the same parent.
Remove the form border of the windows form report windows
with the code for the buttons to open it in the mdi Container
awDushiHomesClients OpenawViewClients;
private void ViewClientsMenuB_Click(object sender, EventArgs e)
{
if (OpenawViewClients == null)
{
OpenawViewClients = new awDushiHomesClients();
OpenawViewClients.MdiParent = this;
OpenawViewClients.FormClosed += OpenawViewClients_FormClosed;
OpenawViewClients.Show();
}
else
OpenawViewClients.Activate();
}
void OpenawViewClients_FormClosed(object sender, FormClosedEventArgs e)
{
OpenawViewClients = null;
///throw new NotImplementedException();
}
for the second button use the same code but rename all awDushiHomesClients to lets say awDushiHomesClientsEng."But then your file name"
don't know what kind of information you are showing but if you just need to rename the column text copy and past the first report and rename it.

Related

Cannot select List as a data source in C# visual studio designer

I have a WinForm with a Listbox, and a class which contains a List I want to use for a data source.
DataSource property for the Listbox wont give me the option for the List I want to use. I know I cannot add this list to the DataSource through designer.cs as its generated and the line just disappears, but..
If I add this to designer.cs it works, until the code disappears:
`this.listbox1.DataSource = Namespace1.MyWinform.MyList.ToArray();`
Only looks like I have no choice but to use the designer properties. How may I achieve this?
Thanks.
As Chetan's comment suggests,the solution is to add the code into the "form_load":
private void Form1_Load(object sender, EventArgs e)
{
this.listbox1.DataSource = Namespace1.MyWinform.MyList.ToArray();
}

How do capture when a worksheet is loaded using AddIn Express to show/hide a ribbon?

I've created an excel plugin using Add-In Express for .NET, but can't seem to figure out how to only show my ribbon when there is a certain set of data on the "Active" sheet.
If the worksheet doesn't contain a certain set of data in certain row of cells, I want to hide my ribbon since the buttons on the ribbon don't apply to all worksheets. When the user switches between different worksheets, I'd like to hide/show the ribbon as appropriate.
I tried using the AddinInitialize event, but this only fires once. I don't want to force the user to open the Excel file directly. They should be able to open Excel, then select the file from the File menu.
Here is what I have so far, but I don't know where to put it:
private void OnAddinInitialize(object sender, EventArgs e)
{
// note: this does not work all the time!
adxRibbonTab1.Visible = IsRibbonVisible();
}
private bool IsRibbonVisible()
{
var worksheet = ActiveSheet;
if (worksheet == null)
return false;
// only show ribbon when top row has certain column headings
var reader = new WorksheetReader(worksheet);
return reader.HasColumns(TopLeftCell, RequiredColumnNames);
}
I've tried creating an ADXExcelWorksheetEvents instance and overriding some of the events, but I'm not having much luck so far. I've not been able to find anything on their website for this type of workflow either.
I'd appreciate any help!
I found the answer. On the AddinModule designer, there is an "Events" item that I had to reference and then I was able to trap the following with my IsRibbonVisible() function:
WorksheetActivated
WorksheetDeactivated
WorkbookActivated
Problem solved!

How to add pop-box alike? c# vs2013

I would like to improve my application's interface. Is it possible to add something like this(refer to image below)?:
When you click the name or move the cursor to the name, a pop up box will appear with user's main info. If possible, can you teach me the appropriate tools to use. I don't mind if it is basic tools, so i can make a little similar to the image.
BTW, i'm using visual studio 2013.
Here is an (absolutely minimal) example of a pop-up Panel that takes care of the showing and hiding:
Panel popPanel = new Panel();
private void linkLabel1_MouseEnter(object sender, EventArgs e)
{
popPanel.Parent = linkLabel1.Parent;
popPanel.Location = new Point(linkLabel1.Left - 20, linkLabel1.Top + 10);
//popPanel.displayData(someDataClassFromSender);
popPanel.Show();
popPanel.MouseLeave += (ss, ee) => { popPanel.Hide(); };
}
For the layout and display of the info on the Panel (or some other control) you should create a class PopUpPanel and give it a method to load the data it shall display..
If it is a web application go check out http://bootsnipp.com/snippets/featured/fancy-navbar-login-sign-in-form
Just change the event from click to hover.
And get youserlf a copy of bootstrap http://getbootstrap.com/

How to Show Other Forms Using DevExpress tileItem in tileControl?

I am new in C# and DevExpress. I'm trying to show another form by clicking a tile in the tileControl group but it doesn't show up. I just right-clicked at the tileControl, clicked view code and manually declared this since this doesn't automatically shows up if you double click a tile.
private void addTile_Click(object sender, EventArgs e)
{
var xForm2 = new XtraForm2();
xForm2.Show();
}
I just right-clicked at the tileControl, clicked view code and manually declared this since this doesn't automatically shows up if you double click a tile.
If I understand this correctly, you did not build your project using the C# code listed above, but only edited the source.
That does not work because what you edit in this way is not being loaded into the app.
Of course, I could be misunderstanding what you wrote.

How to create navigation inside program Form

Warning! This is noob question probably! Sorry in advance.
I'm learning C# (using MS Studio 2013) and I'm having hard time creating some kind of decent navigation in simple desktop program.
Basically what I want is this: MenuStrip with options like "calculate something", "Calculate somethingelse"... and other (that I can easily add later - like dynamic menu on a webpage). If you click first option inside the Form connected with the StripMenu you will get some controls that allows you to do something(like inputs on a webpage). If you click the second all these options will disappear and you will get a fresh set of controls where you can do somethingelse (simply another webpage to play with).
What is the best way to do it (I find it amazing hard to find out :) ). Only way I figured out (more from experience in js then tutorials) is to use show/hide like in javascript/html.
ExamplePanel.Visible = false;
ExampleOtherPanel.Visible = true;
But this doesn't seem right - I think it would be impossible to manage in bigger program (not only in code, but visual designer too - you can only fit that much Panels inside Form).
Any advice? Or at least a link to material where I can find out?
EDIT:
Finaly I gave up and used multiple Forms as sugested in answer.
private void MenuStripExample_Click_1(object sender, EventArgs e)
{
SomeForm SomeForm = new SomeForm();
this.Hide(); //Hide the main form before showing the secondary
SomeForm.ShowDialog(); //Show secondary form, code execution stop until SomeForm is closed
//this.Show(); //You may uncomment this if you want to have the previous Form to get back after you close new one
}
You normaly don't hide and show panels with different layouts. This is not a good design.
If you have complete different navigations/control sets, then create a new Form which is responsible for the control set.
If you don't want to use new Forms take a look at the TabControl.
You may also want to take a look at MDI-Container. You can use a Form as a MDI-Container and display various other Forms as child-elements inside of this container.

Categories