|
Found this on the net that allowed me to use HttpWebRequest (as suggested earlier).
http://mmarinov.blogspot.com/2007/10/using-exsiting-ie-cookies-with.html[^]
Thanks for all those that helped - refining the definition of the problem was very helpful.
Special Note: The WPF WebBrowser control doesn't even fire the events (IFrame navigation) necessary for the above solution. I have to use the Windows Forms version.
modified on Friday, July 24, 2009 2:07 PM
|
|
|
|
|
Public class MyClass<t> where T:int
{
}
why it's giving error. why .net framework not supporting
|
|
|
|
|
You can use struct
public class MyClass<T> where T : struct
{
}
or wrap an int in a (immutable?) class of your own and use that for the constraint.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
why this restriction.
Allowing struct. what problem allowing int?
|
|
|
|
|
You'd have to ask Anders Hejlsberg[^]. It's the way generics were built into C#. Search for generic type constraints and you might find some reasoning.
MSDN[^]
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
public class MyClass<T>
{
...
}
MyClass<int> myClass = new MyClass<int>();
is this what you need ?
|
|
|
|
|
public class CplusEnumExtension<t, f=""> : whehre T:int
{
public CplusEnumExtension(int t)
{
enumT = t;
}
public bool Has(F findvalue)
{
return ((int)(object)enumT & (int)(object)findvalue)>0;
}
private int enumT=0;
}
In above code Has method i comparing int type that's why i expecting int from client side.
Apartment from this
I have implemented code below in C++ which client can use any type.(int, long etc) Is it possible in C#
//EnumT->int,long,Ulong...0x0001;
//Findvalue->ePDVE_DllError
//usage : CEnumerationExtensions<ULONGLONG,ePileplandesign_verificationError> obj(errorcode);
template <typename enumt,typename="" findvalue="">;
class CEnumerationExtensions
{
public:
CEnumerationExtensions(EnumT e)
: enum_(e)
{}
public:
bool Has(Findvalue value)
{
return ((enum_ & static_cast<enumt>(value))>0);
}
private:
EnumT enum_;
};
|
|
|
|
|
What types do you expect you should be able to use with "int" as a constraint?
You would only be able to use a single type - "int" itself (no uint, long etc. - those don't derive from int).
But if there's only one possible type argument, it doesn't make sense to use generics at all!
|
|
|
|
|
Hi,
you might want to enumerate the acceptable types and use common features:
public class MyClass<T> where T : int, long, float, double and now perform addition.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
But multiple constraints mean the type T must implement all of those.
There is no way to say "int OR float" (which would have to automatically generate an interface with all methods common between int and float).
But unfortunately, .NET doesn't support 'dynamic interfaces' (you declare an interface, and all classes having the appropriate methods will automatically implement it). Actually, I think VB10 will have something dynamic interfaces, but I guess it'll be implemented on top of Reflection/the DLR.
|
|
|
|
|
Thanks.
Syntax proposal: public class MyClass<T> where T in { int, long, float, double }
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Right, that would be good. Or the numeric types should implement some sort of IDoMath interface and we could use that.
I also want an enum constriant.
|
|
|
|
|
If they made it so we had a Numeric constraint, or they implemented some common interface (INumeric), that would fix it for all the integral data types and enums too in one go.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I want enums separate from the other types. I have generic classes that should accept enums only. As it stands, I have to check at runtime and throw and Exception.
|
|
|
|
|
Hi,
I'm using the control SplitContainer on run time.
uppon request I'm generating a tab that contains SplitContainers.
I set all the properties as needed including the SplitterDistance,
BUT when the application is running the spliter is not positioned as expected.
it seems that it use some default parameter that ovveride the explicit setting.
Thanks for your help,
lune
|
|
|
|
|
Its hard to comment about it but a wild guess could be to check your dock and anchor properties.
|
|
|
|
|
The dock is fill.
and anchor is top and left.
I saw that if I set the parameter in an event such SelectedIndexChange it works.
but I feel that is wrong to do such a thing (and also it doesn't cover all the cases)
any other guess?
Thanks.
|
|
|
|
|
this comment made me think that may be its some code level change overriding the design view changes. Go through your code and make sure that your adjusted styles not being overridden at code level.
|
|
|
|
|
datagrid is having 4 values.
presently selection is on 4'th record and it is moving to 2'nd record...
how to get previously selected column index(i.e 4'th record) index.
can anyone help me
|
|
|
|
|
i got the code...
thank you...
if (gvcomments.Rows[pre_Index].Cells[CommonConstants.Created].Style.ForeColor == Color.Red)
{
gvcomments.Rows[pre_Index].DefaultCellStyle.Font = new Font(gvcomments.SelectedRows[0].InheritedStyle.Font, FontStyle.Bold);
}
else
{
gvcomments.Rows[pre_Index].DefaultCellStyle.Font = new Font(gvcomments.SelectedRows[0].InheritedStyle.Font, FontStyle.Regular);
}
|
|
|
|
|
handle related index change event and always keep track of previous index in some location. In this way you will always have a valid old index saved and before updating it to newer index you can make use of it.
|
|
|
|
|
Hi,
I'm writing TCP application to communicate with a server machine. There is an interesting thing called TCP Window Scaling, how can i achieve through C#?
|
|
|
|
|
satsumatable wrote: I'm writing TCP application to communicate with a server machine. There is an interesting thing called TCP Window Scaling, how can i achieve through C#?
Based on the Wikipedia definition of TCP Window Scale Option[^], it seems you don't achieve it at the application level.
|
|
|
|
|
Hello All;
i make a user control on c# using ultragrid control the problem is when i take the dll in order to use it in other projects the data doesnt appear, the grid reads the data from the data base
the code of the user control:
the grid name here is ulGrid
public partial class GridUserControl : UserControl<br />
{<br />
Infragistics.Win.UltraWinGrid.UltraGrid ulGrid = new UltraGrid();<br />
Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter ulExcel = new UltraGridExcelExporter();<br />
Infragistics.Win.UltraWinGrid.UltraGridPrintDocument ulPrint = new Infragistics.Win.UltraWinGrid.UltraGridPrintDocument();<br />
<br />
<br />
bool GridRightLeft;<br />
string HeaderTitle;<br />
string HeaderRightDetails;<br />
string HeaderLeftDetails;<br />
<br />
public GridUserControl()<br />
{<br />
InitializeComponent();<br />
ulItasGrid.ContextMenuStrip = contextMenuStrip1;<br />
}<br />
<br />
public delegate void GridEventKeyDown(object sender,KeyEventArgs e);<br />
public delegate void GridEventKeyUp(object sender, KeyEventArgs e);<br />
public delegate void GridEventMouseDown(object sender, KeyEventArgs e);<br />
public delegate void GridEventMouseClick(object sender, KeyEventArgs e);<br />
<br />
<br />
<br />
<br />
public bool GridRightToLeft<br />
{<br />
set<br />
{<br />
GridRightLeft = value;<br />
}<br />
get<br />
{<br />
return GridRightLeft;<br />
}<br />
}<br />
<br />
<br />
public string LeftDetails<br />
{ <br />
set<br />
{<br />
HeaderLeftDetails = value;<br />
}<br />
get<br />
{<br />
return HeaderLeftDetails;<br />
}<br />
}<br />
public string RightDetails<br />
{<br />
set<br />
{<br />
HeaderRightDetails = value;<br />
}<br />
get<br />
{<br />
return HeaderRightDetails;<br />
}<br />
}<br />
DataTable dt = new DataTable();<br />
public DataTable DataTableSource<br />
{ set<br />
{<br />
ulGrid.DataSource = dt;<br />
}<br />
<br />
<br />
get<br />
{<br />
return dt;<br />
}<br />
<br />
}<br />
<br />
<br />
public object DataSource<br />
{<br />
get<br />
{<br />
return ulGrid.DataSource;<br />
}<br />
set<br />
{<br />
ulGrid.DataSource = value;<br />
<br />
try<br />
{<br />
ulGrid.DataBind();<br />
}<br />
catch (Exception ex)<br />
{<br />
throw new Exception(String.Format("Could not bind data to grid"));<br />
}<br />
}<br />
}<br />
<br />
public string DataMember<br />
{<br />
set { ulGrid.DataMember = value; }<br />
get { return ulGrid.DataMember; }<br />
<br />
}<br />
<br />
<br />
<br />
public string HeaderReport<br />
{<br />
set<br />
{<br />
HeaderTitle = value;<br />
}<br />
get<br />
{<br />
return HeaderTitle;<br />
}<br />
}<br />
<br />
public AutoFitStyle AutoFit<br />
{<br />
set<br />
{<br />
this.ulItasGrid.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns;<br />
}<br />
get<br />
{<br />
return this.ulItasGrid.DisplayLayout.AutoFitStyle;<br />
}<br />
}<br />
<br />
public Color Appearance<br />
{<br />
set<br />
{ <br />
this.ulItasGrid.DisplayLayout.Appearance.BackColor = Color.White;<br />
}<br />
get { <br />
return this.ulItasGrid.DisplayLayout.Appearance.BackColor;<br />
}<br />
}
and the code of the connection class for testing the grid:
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Data.SqlClient;<br />
using System.Configuration;<br />
using System.Data;<br />
<br />
<br />
namespace testthegrid<br />
{<br />
class Connection<br />
{<br />
SqlConnection ConnectionStr = new SqlConnection();<br />
<br />
public Connection()<br />
{<br />
ConnectionStr.ConnectionString = "Data Source=.; Initial Catalog=GridExample;Integrated Security=SSPI";<br />
}<br />
<br />
public SqlConnection conn<br />
{<br />
get<br />
{<br />
return this.ConnectionStr;<br />
}<br />
set<br />
{<br />
this.ConnectionStr = value;<br />
}<br />
}<br />
<br />
<br />
public void OpenConnection()<br />
{<br />
if (ConnectionStr.State != ConnectionState.Open)<br />
ConnectionStr.Open();<br />
}<br />
<br />
<br />
public void CloseConnection()<br />
{<br />
try<br />
{<br />
if (ConnectionStr.State != ConnectionState.Closed)<br />
ConnectionStr.Close();<br />
}<br />
catch { }<br />
}<br />
}<br />
}
and the code for testing the grid is:
<br />
namespace testthegrid<br />
{<br />
public partial class Form1 : Form<br />
{<br />
private Connection connection = new Connection();<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
FillGrid();<br />
}<br />
private void FillGrid()<br />
{<br />
connection.OpenConnection();<br />
DataTable dt = new DataTable();<br />
SqlDataAdapter da = new SqlDataAdapter("select * from AccountInfoA", connection.conn);<br />
da.Fill(dt);<br />
gridUserControl1.DataTableSource = dt;<br />
connection.CloseConnection();<br />
<br />
}
there is no data appears in the grid
thanx a lot
|
|
|
|
|
Try setting up the binding BEFORE you read the data.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|