|
thanks,
have not used these yet. i did not knew. i am new to these.
will really appreciate if u can provide a simple example.
regards,
rnv
|
|
|
|
|
How can i handle graphic object such as line, circle,... to catch click_event, etc? Thanks
Nothing
|
|
|
|
|
hi everybody ,
i'm trying to call a global function from another file in the project.
In Vb i usually create a module and put into my global public functions so i can access them from any other page.
Can anybody help me to make this working in C# ?
Public Module General
Public Function MyFunction(...,...) As Integer
......
return theInteger
End Function
End Module
the call:(from another page)
Dim xyz As Integer = MyFunction(...,...)
Charbel from Lebanon
|
|
|
|
|
There is no modules in C#. You can use namespaces:
namespace TestingNS{
//some declarations here
}
If you have one namespace defined in several files (or even projects, if they are referenced), all declarations are combined.
Also, there can be no global functions in C#, as all functions must be methods of some class. So you can use static methods:
namespace General {
public class GlobalFuncs {
public static int MyFunction(...,...){
...
}
}
}
then call it from other file:
General.GlobalFuncs.MyFunction(...,...);
if this ^^^ statement is located in the same namespace (General), then it can be written shorter:
GlobalFuncs.MyFunction(...,...);
Offcause you must decide, if this method must be static or instance.
|
|
|
|
|
Thank you Vitaliy , that's what i want.
By the way
when i try to create a new instance of a class in C#
private ClsCompany IVComp = new ClsCompany();
it gives me this message during the building
(The type 'ClsCompany' has no constructors defined)
#region "Constructors"
ClsCompany()
{
}
#endregion
while in vb :
Private IVComp As New ClsCompany
#Region "Constructors"
Sub New()
End Sub
#End Region
it creates the object.
Charbel from Lebanon
|
|
|
|
|
You could make the constructor public
modified 12-Sep-18 21:01pm.
|
|
|
|
|
given what you've shown there, i would have thought you'd get a message saying the constructor was inaccesible due to its protection level. I haven't used a module since vb6, but if they do what i assume they do in the new version i would be tempted to do the following
namespace <namesspace definition="">
{
public class Utils
{
public static string SomeUtilFunction()
{
return "Hello World";
}
}
}
In the cs file where you want to use the function:
do the using thing if it's a different namespace
then something like:
Console.WriteLine(Utils.SomeUtilFunction());
hth
Russ
|
|
|
|
|
Hi, All.
Here's the problem: I have an image and I need to clear portion of that image. How can I do that? I've tried FillRectangle with transparent and translucent colors with no luck. Graphics.Clear does the trick, when called with KnownColor.Transparent, but it clears all image.
|
|
|
|
|
Look don't get mad if im asking this coz im very new in c# ok so don't get MAD ok..Very Rookie
now to start this question how can i get the value of the textbox using C#.. in inserting a new Record.... please help meee
|
|
|
|
|
Hi its like this inserting a new record...
sqlConnection1.Open();
SqlDataAdapter sda = new SqlDataAdapter ("", sqlConnection1);
DataSet ds = new DataSet();
sda.Fill(ds);
//dataGrid1.DataSource = ds.Tables[0];
sqlConnection1.Close();
how can i insert a new record if i need to get the value of the textbox...
how can i do that? wtf:
|
|
|
|
|
I dont think the question is clear....
var = textbox1.Text
will give u the value. ie the text that you type inside the textbox.
if its a number you could convert it to int by
int i=Convert.toInt32(textbox1.Text);
is that what u asked ?????
Leejo
|
|
|
|
|
I need code and project about "reduce dfa" (with Graphics) .Please help me!
Thank a lot!
|
|
|
|
|
Yeah, just hand over and entire project, prewritten for you. Sure! Not!
Get out your credit card and try http://www.rentacoder.com[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can i change nfa to dfa in C# or VB
|
|
|
|
|
|
I'm developing a small application in C# that uses DirectShow to display moving video on multiple Panels.
I want to be able to capture the mouse buttons and movement when the mouse is over the Panels. However the mouse call backs do not seem to work when the handle for the Panel is passed to DirectShow. The mouse call backs do work for a normal Panal, so the problem must with Direct Show.
Any ideas ???.
|
|
|
|
|
Is it possible to create a ISAPI filter in .NET. I had gone through a couple of articles that did not seem to help me.
My purpose for this filter is I want to block access to a site if the Request comes from certain IP address.
How do I go about creating one. Can some one please help me with it.
Leejo
|
|
|
|
|
Is it possible? Yes. Practical? No.
There is a bunch of Interop code that has to sit between your Managed C# code and the Unmanaged code world of IIS. This just adds a bunch of overhead to each and every request going to the web server. That means you're sacrificing your web servers performance to use a managed language.
If this is really how you want to go about it, write it in C++. I don't think you'll find any examples of doing this in C#. Oh! You'll also probably have to write a management utility to go along with this filter. How else are you going to tell the filter what addresses to block?
But, if all you want to do is block requests from certain IP's, then that what the firewall is for. Put the block where it belongs and leave the web server running as little code as possible to do its job. This will only result in better stability and easier management of the server.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you for the reply.
Actually we have a Filter running on the server. It was developed in c++ couple of yrs back. I was wondering whether I could port that code to .NET.
The actual functionality that this filter is supposed to do is block Web Page requests that come from certain Countries and allow page requests from certain countries.
Can I get this logic working using Will ISAPI extensions and ISAPI filters
Leejo
|
|
|
|
|
Sure, you could move the logic to a newer .DLL. .NET won't have anything to do with this though, since ISAPI filters have no support in the .NET Base Class Library.
If you want to get this to work in Managed Code (C#, VB.NET, Managed C++), you could. But like I mentioned before, there is a performance penalty for going between managed and unmanaged code. There is a reason why you don't see examples of ISAPI implementations in C#.
If all your doing is blocking requests from certain IP's, nets, or entire countries, your best tool is still the firewall sitting in front of your web server. That's it's entire mission in life! To stop "this and that" traffic from reaching a network its protecting. If the firewall is blocking traffic from IP's, and more importantly, traffic trying to reach certain ports on machines inside the wall, your web server has less work to do that has nothing to do with serving web pages. Why have the web server run more code than it needs to?
By putting up the firewall and blocking everything that isn't going to port 80, or whatever port your using for HTTP, you reduce the attackable surface of your web server, thereby increasing its security and reliability.
Now, as I get off the Soapbox, there are HttpHandler and HttpModule interfaces that can provide similar functionality to ISAPI, though not a complete replacemnet for ISAPI. Look here[^] for some introduction and docs.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,I have two questions.
1.Can I use vs2003 with .net 2.0,I want to use datagridview control,which is availabe only in 2.0.
2.Can I use generics in vs2003,msdn say generics is only supported in 2.0 and later.Is there an easy way to use generics in vs2003.
|
|
|
|
|
zhangxinghai wrote: Can I use vs2003 with .net 2.0
No, but the opposite is true.
zhangxinghai wrote: Can I use generics in vs2003
No, also.
zhangxinghai wrote: Is there an easy way to use generics in vs2003.
So why don't you just download the Free Editions of Visual Studio Express ?[^]
------------------------------ "The Soapbox has been so ..."
|
|
|
|
|
Hi!
Short answer: No way.
VS 2002 -> .NET 1.0
VS 2003 -> .NET 1.1
VS 2005 -> .NET 2.0
And you'd better believe MS that generics are not available until .NET 2.0.
Regards,
mav
|
|
|
|
|
hi,
i have been working on a school project for a few weeks, which some settings data need to be store in a external file (such as .txt). I am able to read/write data from/to the text file but the problem is that the settings configuration is always changing. The settings that is key in by user have to be updated to the text file. For the external file i used system IO, streamreader and streamwriter. But i am unable to edit the data in the text file when the user change the settings.
I would like to know if there is any other method in doing the updating of the setting to the text file.
thank you
orrjiao
-- modified at 3:08 Tuesday 15th November, 2005
|
|
|
|
|
In a datagrid code which is like this
<asp:datagrid id="dgAllCircles" style="Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 136px" runat="server" pagesize="5" showfooter="True" allowpaging="True" onitemcommand="MyFunct" autogeneratecolumns="False">
<itemstyle font-size="Smaller" font-names="Verdana" horizontalalign="Center">
<headerstyle font-size="Smaller" font-names="Verdana" font-bold="True" horizontalalign="Center">
<columns>
<asp:boundcolumn datafield="SrNo" headertext="Sr No">
<asp:boundcolumn datafield="CircleZip" headertext="Circle Zip">
<asp:boundcolumn datafield="CircleName" headertext="Circle Name">
<asp:templatecolumn headertext="Edit">
<itemtemplate>
<asp:button id="cmdInfo" text="More Info" commandname="Info" runat="server">
<asp:templatecolumn headertext="Delete">
<itemtemplate>
<asp:imagebutton id="Imagebutton3" runat="server" causesvalidation="False" commandname="Delete" imageurl="images\g_Delete.jpg">
<pagerstyle nextpagetext="Next" font-size="Smaller" font-names="Verdana" prevpagetext="Prev">
I am getting event when I click on Next or Prev link of page But I am not hetting the events when I click on button .Any Idea please.
Thank you.
|
|
|
|