|
i have created 2 datagrids. The upper one displays the currently available values and the lower one allows entering new avalues... When u enter a vale to the lower grid and click on a button(Add) the selected value
(s) should be added. If one entered a valid row and another row with missing fields only the valid row should be added and the invalid row should be remained (displayed).How can I achive this?.
samitha
|
|
|
|
|
Get the row index of the row that is valid and use
DataTable.Rows.RemoveAt(rowIndex);
For each row that is valid, this will remove the row from the table the datagrid is bound to and therefore remove it from the datagrid itself.
Kev Pearman MCP
|
|
|
|
|
how can i reverse-engineered from IL?
How can I stop my code being reverse-engineered from IL?
is there any tools for this ?
********************
S r e e j i t h N a i r
Bangalore - India
********************
|
|
|
|
|
There are useful c# tools in the following link.
http://msdn.microsoft.com/vcsharp/team/tools/default.aspx
You can obfuscators also to prevent reverse engineering.
|
|
|
|
|
how can i reverse-engineered from IL?
How can I stop my code being reverse-engineered from IL?
is there any tools for this ?
********************
S r e e j i t h N a i r
Bangalore - India
********************
|
|
|
|
|
sreejith ss nair wrote:
how can i reverse-engineered from IL?
Use .NET Reflector. Search it on the internet.
sreejith ss nair wrote:
How can I stop my code being reverse-engineered from IL?
You must obfuscate it. There are many thrid parties that can do that.
Regards,
Alexandru Savescu
|
|
|
|
|
hi,
how to get user object password in active directory(for example using c#).
and how to set the memberOf property of the user object using C#;
Thank you
|
|
|
|
|
How I can transfer a file from the host to the client using .NET Remoting?
I try the following but not success.
Server Code:
static void Main(string[] args)
{
HttpChannel chnl = new HttpChannel(1403);
ChannelServices.RegisterChannel(chnl);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(ObjectCreation), "ObjectCreation.soap", WellKnownObjectMode.Singleton);
Console.WriteLine("Press key to terminate server");
Console.ReadLine();
}
public override object getAssembly()
{
string fileEntries = AppDomain.CurrentDomain.BaseDirectory + "HelloWorldClass.doc" ;
return LoadBinary(fileEntries);
}
private object LoadBinary(string Path)
{
object tAsm;
FileStream fs = new FileStream(Path,FileMode.Open,FileAccess.Read);
BinaryFormatter bf = new BinaryFormatter();
tAsm = bf.Deserialize(fs);
fs.Close();
return (object)tAsm;
}
Client Code:
private void cmdConnect_Click(object sender, System.EventArgs e)
{
ChannelServices.RegisterChannel(chnl);
obj = (BaseRemoteObject) Activator.GetObject(typeof(BaseRemoteObject),
"http://localhost:1403/ObjectCreation.soap");
MessageBox.Show("Channel to Server has connected");
}
private void cmdCallClass_Click(object sender, System.EventArgs e)
{
string fileEntries = AppDomain.CurrentDomain.BaseDirectory + "HelloWorldClass.dll" ;
object tAsm = obj.getAssembly();
FileStream fs = new FileStream(fileEntries,FileMode.Create,FileAccess.Write);
BinaryFormatter bf = new BinaryFormatter();
try
{
bf.Serialize(fs,tAsm);
fs.Close();
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
lAss = Assembly.LoadFrom(fileEntries);
Type[] FrmType = lAss.GetTypes();
foreach (Type typ in FrmType)
{
object lObj = Activator.CreateInstance(typ);
MethodInfo mi = typ.GetMethod("HelloWorld");
mi.Invoke(lObj , null);
}
}
|
|
|
|
|
I am learning C#, coming from VB.NET
I would like to know what method is commonly used to make a decision based on the contents of an object.
For something like:
if ( obj is MyType1 )
...
else
if ( obj is MyType2 )
...
else
if ( obj is MyType3 )
...
could be quite lengthy.
Naively:
switch( obj )
{
case MyType1:
...
Case MyType2:
...
Case MyType3:
...
}
This, I realise is incorrect because switch only accepts integral types or strings.
Is there another way of doing it?
Any help appreciated,
Shayne
|
|
|
|
|
Try
<br />
string temp = Object.GetType().ToString();<br />
switch(temp)<br />
{<br />
case "typeA":<br />
break;<br />
case "typeB":<br />
break;<br />
default:<br />
break;<br />
}<br />
Kev Pearman MCP
|
|
|
|
|
Or, the best way is to use visitor pattern (http://www.dofactory.com/Patterns/PatternVisitor.aspx), especially if you cast your objects after doing "is".
if (obj is MyType)
{
objOfMyType = (MyType)obj;
...
}
The visitor pattern will get rid of casts, and allow you to create new classes and not having to add if (obj is MyNewType) or case statements.
|
|
|
|
|
I am trying to develope a small RTF writer to generate project report at runtime, with a limited RTF writing capability. RTF is one page document only, untill we intentionally put page breaks in it and Project report consists of number of pages. Thus, on what criteria it should be decided to insert page break? How to keep track of page's empty area before inserting anything?
Please guide.
|
|
|
|
|
|
Yes some information is given under 'Page Information', but is there some way to identify exactly how many characters I can print before I run out of room in the current rectangle that defines the output, and go to a new page. There is no real-time example
|
|
|
|
|
Is this correct ? : (if i inherit this class)
<br />
Public MustInherit Class Singleton(Of T)<br />
Private Shared Instance As T<br />
Private Shared Created As Boolean<br />
<br />
Public Shared Function GetInstance() As T<br />
If Not Created Then<br />
Instance = Activator.CreateInstance(GetType(T), True)<br />
Created = True<br />
End If<br />
Return Instance<br />
End Function<br />
<br />
Public Overrides Function ToString() As String<br />
Return "Instancia única de " & GetType(T).ToString<br />
End Function<br />
<br />
End Class<br />
P.D.:I know it is not C# but right now i don't have generics-enabled C# right here.
|
|
|
|
|
Here is a singleton in C#:
public sealed class SqlManager
{
private SqlManager(){}
private static SqlManager instance;
private static object syncRoot = new Object();
public static SqlManager Instance
{
get
{
if(SqlManager.instance == null)
{
lock(syncRoot)
{
if(SqlManager.instance == null)
{
SqlManager mgr = new SqlManager();
System.Threading.Thread.MemoryBarrier();
SqlManager.instance = mgr;
}
}
}
return SqlManager.instance;
}
}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
The request failed with HTTP status 401: Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
|
|
|
|
|
|
I have a problem when displaying a report that have more than 1 page.
When I click on "next page" button in crystal report toolbar, the page cannot be shown .
and, now my code is look like this :
rpt.SetDataSource(dataSet21);
CrystalReportViewer1.ReportSource = rpt;
|
|
|
|
|
Have you placed the special field "Page N of M" on your report?
This should force the report to load all pages on startup. Otherwise it tries to load the pages dynamically (as far as I know).
Don't know if this could solve your problem, but maybe you'll give it a try...
-------------------------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
Hi, I'm looking for a free menu/toolbar library (ideally with rebar/coolbar support ala IE6; Windows XP support would be icing). My target environment is an Explorer Bar, where top-level menus don't exist because they're not Windows applications, but I need a menu anyway. I've tried using the WinForms.ToolBar class as well as Lutz Roeder's CommandBar library. Both have flaws, perhaps a shared flaw in the WinForms.CommonDialog class clashing with the WinForms.Button class in this environment.
Anyhow, it seems that the relevant articles on this site don't seem to meet my criteria, and I'd like a free library (free as in beer, although source code would be nice, too). Nothing necessarily too fancy, although icon support and font/color customization of the text would be helpful.
By the way, does anyone know of a good repository of open-source .NET libraries and such besides this site? I know of WindowsForms.net and GotDotNet. They're okay.
Thanks!
Arun
|
|
|
|
|
If you're willing to wait couple months (or use beta software) .net framework 2.0 will have those.
|
|
|
|
|
I'm trying to create a C# class with functionality similar to the one from this article:
http://www.codeproject.com/cpp/enumleafclasses.asp
The only problem I have encountered is that under my design an instance of the leaf class must be created before the class will registered itself. This is not so with the code from the article.
How can I have a leaf class register itself with its base class without needing to create an instance of the leaf class?
The base class has the following member of my class defined:
protected static LeafFactory _LF = new LeafFactory(Type.GetType("LeafFactory_dev.BaseClass"));
And this is how I currently register the leaf class in its constructor:
BaseClass._LF.RegisterLeaf(this.GetType(), "description here");
-- K
|
|
|
|
|
I was checking out Ianier Munoz's implementation of streaming audio input using the DirectSound API and C# .NET. My question has to do with a problem I'm facing in C#.
The function I want to access is declared as follows:
[c]
public void Play(nsStreamPlayer.PullAudioCallback pullAudio)
{
// Bunch of stuff
}
[/c]
nsStreamPlayer is a namespace in which a delegate and an interface are defined.
[c]
namespace nsStreamPlayer
{
///
/// Delegate used to fill in a buffer
///
public delegate void PullAudioCallback(IntPtr data, int count);
///
/// Audio player interface
///
public interface IAudioPlayer : IDisposable
{
int SamplingRate { get; }
int BitsPerSample { get; }
int Channels { get; }
int GetBufferedSize();
void Play(PullAudioCallback onAudioData);
void Stop();
}
}
[/c]
The "Play" function is defined in a nested private class
[c] private class PullStream : Stream [/c]
which itself belongs to a public class StreamingPlayer
[c] public class StreamingPlayer : IDisposable, nsStreamPlayer.IAudioPlayer [/c]
NOW: On my mainform designer I have a button called btnStartStream.
I want to write the code such that clicking btnStartStream calls the play function. How do I do this? Everything I've tried throws up an error message.
I know I'm missing something basic. Could you please help me out?
Thanks a lot for your time!
|
|
|
|
|
You have an instance of the StreamingPlayer class, correct?
StreamingPlayer stmPlyr = new StreamingPlayer();
private void btnStartStream_Click(object sender, EventArgs e)
{
PullAudioCallback cbk = new PullAudioCallback(someAudioCallBack);
stmPlyr.Play(cbk);
}
private void someAudioCallBack(IntPtr data, int count)
{
}
- Nick Parker My Blog | My Articles
|
|
|
|