|
Hi,
I need an additional button including a handler in a System.Windows.Forms.SaveFileDialog() to do customized processing instead of a "Save" as implemented by default. To complicate matters, this dialog is opened from within WPF since WPF itself lacks such dialog.
What are the pieces needed to implement such custom SaveFileDialog(), please?
Thank you!!
|
|
|
|
|
You will need to build your own dialog, just like any other dialog you would build. So you will need to identify the controls you see in the system dialog and reproduce that yourself.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You cannot do much with the existing control.
|
|
|
|
|
Create your own custom dialog class that inherits FileDialog [^].
Use the best guess
|
|
|
|
|
|
i search google first to get any ready made sample for numeric pager for win form but unfortunately i found none. many exist for web application. so i have decided to develop my own. i have take one user control and i want to add some label on the user control at run time for simulating numeric pager link.
like << < 1 2 3 4 5 > >>
here is my code so far
public partial class PagerBar : UserControl
{
public PagerBar()
{
InitializeComponent();
}
int totalrecords = 0;
public int TotalRecords
{
get { return totalrecords; }
set { totalrecords = value; }
}
int recordsperpage = 0;
public int RecordsPerPage
{
get { return recordsperpage; }
set { recordsperpage = value; }
}
int curpage = 0;
public int CurrentPage
{
get { return curpage; }
set { curpage = value; }
}
int maxpagerlink = 0;
public int MaxPagerLink
{
get { return maxpagerlink; }
set { maxpagerlink = value; }
}
public bool HasPreviousPage
{
get
{
return (CurrentPage > 1);
}
}
public bool HasNextPage
{
get
{
return (CurrentPage + 1 <= RecordsPerPage);
}
}
int pagecount = 0;
public int PageCount
{
get
{
pagecount = TotalRecords > 0 ? (int)Math.Ceiling(TotalRecords / (double)RecordsPerPage) : 0;
return pagecount;
}
}
public void BuildPager(int CurrentPage)
{
if (CurrentPage >= MaxPagerLink)
{
}
else
{
}
}
}
my first prev,next & prev button will be fixed. i will not generate these button at run time. i want to generate only numeric link like 1 2 3 4 5 etc at run time on user control.
one thing i need to fix that number of pager bar is will be fixed in my case and that is 5. i want to show always 5 pager link like 1 2 3 4 5 or 6 7 8 9 10 etc.
suppose total records is 36 and i want to show 10 records per page so 4 pager link i need to generate at run time. the right logic is not coming to my mind to generate pager link in such a way if number of records is 110 then everything should be handle properly. if total records is 110 and records per page is 10 then total pager bar should be 11 but i want to show only 5 at a time. first time 1 2 3 4 5 when user click on 5th pager bar and next time click on next button then pager link will be 6 7 8 9 10. this way i want to show pager link but right logic is not coming to mind to generate the way i want to display pager link. it will be great help if some one help me to handle generation of 5 pager link always.
tbhattacharjee
|
|
|
|
|
Hi friends,
I have used below mentioned article to launch an application using windows service.
[^]
however after using the above mentioned code i was able to start the application written in c sharp. but as soon as its get started the main form is getting minimized and even i am not able to get the icon into system tray. however i can view the application into Windows 7 task manager. Let me know if you can help me out the same. Waiting for your positive reply.
|
|
|
|
|
If you have a question relating to an article, you should ask in the forum at the end of the article. It's highly unlikely that the author will happen to walk on by this post and open it up.
|
|
|
|
|
Hello everyone, thank you in advance for your help.
I want to make invisible the selected row of my datagridview but I have a problem with my code
1 - When I do this
dataGridView1.CurrentCell = null;
dataGridView1.SelectedRows [0] Visible = false.;
Index was out of range. Must be non-negative and less than the size of the collection.
2 - When I do this
dataGridView1.SelectedRows [0] Visible = false.;
Row associated with the currency manager's position cannot be made invisible.
What should I do. Thank you
|
|
|
|
|
1. Make sure that you actually have a collection of SelectedRows [^].
2. Not sure, but presumably this has something to do with your data binding.
Use the best guess
|
|
|
|
|
it's ok thank u
int k = dataGridView1.SelectedRows[0].Index;
dataGridView1.CurrentCell = null;
dataGridView1.Rows[k].Visible = false;
|
|
|
|
|
Hi.
I'm trying to open/edit and print a excel file in a pc without office istalled.
how i do that?
thanks.
|
|
|
|
|
To edit the file from code, you can use NPOI[^], or EPPlus[^] for Excel 2007/2010/2013 files. Both libraries are free and open-source.
However, neither library seems to support printing the file. You might need to look for a commercial library to do that.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
|
Hello Friends,
Thanks in Advance... I am using VS2012 ON WIN7 as my development tool.
I want to get data from C++ into my C# 2D arrays, Arrays are member of strucutre.
I am getting data fine in case of Single dimension arrays and basic data types.
Below is the sample code:-
I have a C# strcuture having 3-4, multidimensional array example.
[StructLayout(LayoutKind.Sequential)]
public struct CompMultiArray
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2 * 200)]
public int [,] tempVacData;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2 * 200)]
public int [,] tempFuncData;
};
Public void GetDataFromUnmanagedCode()
{
CompMultiArray cmpGetData = new CompMultiArray();
cmpGetData .tempVacData = new int[2, 200]; // Allocating or not allocating has no effect
cmpGetData .tempFuncData= new int[2, 200]; // Allocating or not allocating has no effect
CPPClass.FillData(ref cmpGetData);
}
C++ side
struct CompMultiArray
{
int tempVacData[2][200];
int tempFuncData[2][200];
};
void FillData(CompMultiArray& cmData)
{
for(int i =0; i< 2; ++i)
{
for(int j = 0; j < 200; ++j)
{
cmData.tempVacData[i][j] = 100;
cmData.tempFuncData[i][j] = 200;
}
}
}
If I see data in C# side after getting from unmanaged code in Windows->Memory (VS2012), I can see correct data in memory. GC Code to get memory address
GCHandle gch = GCHandle.Alloc(cmpGetData.tempVacData, GCHandleType.Pinned);
// Get a pointer to the array data...
IntPtr pArrayData = gch.AddrOfPinnedObject();
// Via the debugger's memory viewer, confirm
// that the data is laid in memory in sequence.
gch.Free();
But using indexing, i cannot get any data.
for(int i = 0; i < 2; ++i)
{
for(int j = 0; j < 200; ++j)
{
cmpGetData.tempVacData[i,j];
cmpGetData.tempFuncData[i,j]
}
}
please ignore, Dllimport etc. all things are working fine.
please guide me.
Thanks,
Subhash
|
|
|
|
|
This may not be possible in your case, but since you have provided the C++ code, have you tried compiling the C++ part as C++/CLI and using managed arrays in the C++ part? You could then make the C++ part a DLL that is referenced in your C# project.
I do this all the time in order to get over the difficult unmanaged/managed boundary.
|
|
|
|
|
Class a
{
a obj=new a();
}
in this case we are calling the default constructor
but
class a
{
public a(int i)
{
console.writeline(i);
}
a obj=new a(); //Gives error during compilation
}
In this case we can't call default constructor after creating a custom constructor.
But why it happns???
Why we cant use default constructor in this case
|
|
|
|
|
Because it doesn't have one.
|
|
|
|
|
means?, can u describe it
|
|
|
|
|
In your first version of class a, you haven't specified a constructor. This means that a default constructor is created for you. As soon as you add a constructor, you lose the default constructor. This is exactly what should happen because you can't instantiate a class that doesn't have a constructor, and you don't want the compiler to give someone the ability to use a default constructor if your class relies on values that are passed in via the constructor.
|
|
|
|
|
thnks for this answer i appreciate it
|
|
|
|
|
Classes only have the constructors you create - if you don't create any at all then a parameterless constructor is created for you.
Structs, being value types, are different and always have a default parameterless constructor with all the fields initialized to their default values (normally zero, or null if the field is a reference type).
|
|
|
|
|
Because the language specification says so.
17.10.4 Default constructors
If a class contains no instance constructor declarations, a default instance constructor is automatically
provided. That default constructor simply invokes the parameterless constructor of the direct base class.
Really it should be have said "if and only if", because that's what they mean. If you don't define a ctor, the default one exists. If you do define a ctor, the default one goes away. You can get it back if you want, because it's trivial:
public TypeName() { } (it would be protected for abstract classes)
|
|
|
|
|
Would like to ask what are the possible causes for columns of cells in a datagridview not to show values being pushed into it?
I have a datagridview with about 40+ columns and for some strange reason a number of columns are able to accept values I am pushing into them using:
datagridview.rows[rowindexhere].cells[columnindexhere].value = valueToPushHere;
whereas a number of others wont accept it? This is really weird and not sure if there a re some undocumented things or limitations about Datagridview control that new users like me need to be aware of to ensure successful push of info into the control 100% of the time?
Thanks so much for all the help you could give ... I really appreciate it.
Matt
|
|
|
|