|
if some one can tell how to block pages.
i have small website and have abought 10 pages but when i copy
and put it in browser they open i want block that want to redirect them to login page .
thank you
|
|
|
|
|
daku1 wrote: if some one can tell how to block pages.
.
I'm not so sure what you meant by "how to block pages".
daku1 wrote: when i copy
and put it in browser
How did you put all of your 10 pages in browser?
I think your question may be related to ASP.NET or web development. so please ask in ASP.NET section.
Maybe. you may use "Form authentication" in your project to achieve that goal..
|
|
|
|
|
I feel a bit dumb, but: How do I add an icon resource to a custom Windows Forms control? I want to draw that icon in the OnPaint override.
|
|
|
|
|
Hi,
you can add an .ico file to your project, then set the build action to "embedded
resource". In order to access it, you need some code I can't remember, but
Visual knows how, so set your form's icon to it with the Designer, then watch
what code got generated to do it.
But then you want to paint it in an OnPaint method ? Normally you don't paint
icons, you can paint text, lines, images. Icons are special, they get used
first and forall by the form. No painting involved, just set the form's Icon
properety to point to it.
If you want to draw an image (not an icon!) somewhere inside your form,
you can store that too as a resource; almost the same procedure.
|
|
|
|
|
Hello,
Like Luc suggested:
you can add an .ico file to your project, then set the build action to "embedded
resource".
To instanciate the Icon, you would have to use following constructor:
http://msdn2.microsoft.com/de-de/library/b5bzkwt9(VS.80).aspx[^]
The parameters are
1) A Type, which represents the Assembly in which the ressource is expected.
2) A string, which represents the name of the ressource.
To Draw the Icon, you could use: Graphics.DrawIcon
private System.Drawing.Icon yourIcon = null;
protected override void OnPaint(PaintEventArgs e)
{
if(yourIcon==null)
{
yourIcon = new Icon(typeof(YourNameSpace.ExampleControlClass), "YourIconName");
}
if(yourIcon!=null)
{
e.Graphics.DrawIcon(yourIcon, 10,10);
}
base.OnPaint (e);
}
All the best,
Martin
|
|
|
|
|
Hi,
I'm late but thanks for the reply
I had to replace thie load code with
m_icon = new Icon(
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("FlowLayout.ffnl.ico"));
It seems that the GetType() version does not work for class libraries.
(flowlayout is the project name, the "full" name of the ressource can be seen with reflector, too)
|
|
|
|
|
Hello,
peterchen wrote: I'm late but thanks for the reply
peterchen wrote: It seems that the GetType() version does not work for class libraries.
Never had this situation bevor, so thanks for the info!
All the best,
Martin
|
|
|
|
|
Having the following issues.
- Title Bar flashes or blinks going from form to form.
No solution yet.
- Loading Form appears after message box pop up on some forms. Unable to get back to application.
No solution yet.
- Disconnected Thread method updating form after all messages processed. Can not update form from thread.
No Solution yet.
Hani
|
|
|
|
|
Hi,
if you have a question, ask your question; make sure you explain (and
maybe show code, using PRE tags) in such a way that some one could maybe
understand it and help you.
If you have several questions/problems I suggest not to mix them in one
message, unless you are convinced they are related.
So far, no solution yet, lacking information.
|
|
|
|
|
first, sorry for my bad english...
How can i mount a cd-drive with c# , or mount a web-drive like gmail drive??...
Thanks
|
|
|
|
|
This site:True Crypt[^] is not C# but may be able to help you with mouting virtual drives. The program is open source and allows virtual drives to be attached to operating system with ease.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I have code that is functioning in VB6 that I need to update to C# and I am new to programming in C#. Please let me know if anyone can help. I am using the Datalink command to wait for a data string with a CRLF at the end of data, then I wait for the next string. The IP address of the server application is 192.168.255.3 port 5001.
'Auto connect the DVT vision system at this time using the IP address of the camera
DVTSID1.RemoteHost = "192.168.255.3"
DVTSID1.Connect
'Show the current images in the video display window
DVTSID1.PlayImages
'Connect to the Datalink of the DVT camera to import the data
DataLink.Connect (DVTSID1.RemoteHost)
'Receives data through the DataLink connection. Assumes EOL termination
'in the FrameWork setup is CrLf
Private Sub DataLink_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Dim data As String
Dim pos As Long
Dim txtdata As String
Dim ret As Integer
Dim work As Variant
DataLink.GetData strData, vbString
data = data + strData
pos = InStr(data, vbCrLf)
End Sub
Thank you.
Jason
|
|
|
|
|
Jason, what exactly are you having trouble with? The DVTSID1 component? Declaring the strings? Declaring the function? (by the way, that looks like an incomplete function, as there's a "End Sub" but there's no beginning of the function, e.g. the declaration)
|
|
|
|
|
You are right I didn't get everything when I copied the code. I am doing other functions after I receive the data that are not related so I just copied the code I was having questions about. The main question I have is the Datalink function, it does not seem to exist in C#, at least to my understanding. As I stated I am not familiar with C# as of yet. So I want to listen to port 5001 using the IP address, what would be the best way to accomplish this task?
Thank you
Jason
|
|
|
|
|
Hey Jason,
I've never heard of DataLink until now. A quick Google search reveals this article[^], which mentions that it is a COM object. Since it is a COM object, you can use it in C# (or any other .NET language). See the article for an example on how to do this in VB.NET, but it should be essentially the same steps in C#.
Let me know if you have any more questions.
|
|
|
|
|
I need to convert any integer value greate than 127 to binary value using this example:
Represent the value in binary
(e.g 137 => 1000 1001)
2) Break in up in groups of 7 bits from the lowest significant bit.
(1 | 000 1001)
3) Take the lowest 7 bits and that gives you the lowest byte (0000 1001)
4) For the next group of 7 bits (in the example, this is 000 0001), set the MSB to 1 (which gives 1000 0001 in our example).
Thus 137 becomes:
1000 0001 0000 1001
can anyone help me do this code using | & operators shif to left operators
Thanks
|
|
|
|
|
Hi,
I suggest you use unsigned integers for binary, octal, hexadecimal conversion.
It is much easier, all 8/15/32/64 bits then behave in the same manner.
Fara76 wrote: Break in up in groups of 7 bits
That is definitely wrong, today's computers have 8 bits in a byte, and one or
more bytes in their data path components (registers, ALUs, data bus, ...); there
is absolutely no reason whatsoever to work in groups of 7 bits.
|
|
|
|
|
static void Main(string[] args)
{
int number = 0;
try
{
if (args.Length == 0)
{
throw new Exception("Number not specified");
}
if (!int.TryParse(args[0], out number))
{
throw new Exception("Could not convert value to integer");
}
const int power = 7;
int tmpNumber = number;
int i = 1;
int maxValue = (int)Math.Pow((double)2, (double)power * i);
while (number >= maxValue)
{
tmpNumber |= maxValue << 6;
maxValue = (int)Math.Pow((double)2, (double)power * ++i);
}
Console.WriteLine(tmpNumber.ToString());
}
catch (Exception ex)
{
Console.WriteLine("Exception occured");
while (ex != null)
{
Console.WriteLine(String.Format("Message: {0}", ex.Message));
Console.WriteLine(String.Format("Stack trace: {0}", ex.StackTrace));
ex = ex.InnerException;
}
}
finally
{
Console.ReadLine();
}
}
|
|
|
|
|
Thanks a lot, but would you explain the code please? i get 8329 for the value of 137? i don't understand why? and i also can you please explain how to change the final answer to bytes so i will have 100000001 00001001 in bytes ?
Thanks
|
|
|
|
|
It looks like you're trying to implement a multi-precision integer. But outside of the MIDI specification I don't know where an MPI of this type would still be in use today, so it sounds almost like a homework assignment.
What do you have so far? Maybe we could take a look at that and figure out what's going wrong in your code.
|
|
|
|
|
I finally fixed the code, it is working now! thanks anyway
|
|
|
|
|
I am trying to implement state verification as part of our automated testing framework. I want to use aspects to run a pre check and post check of any particular method call and only have an attribute indicating that that would be a verifiable method. This would be transparent to both the called and client code, performance is not an issue.
There are two articles i have fond on the code project that touch on aspects in C#:
http://www.codeproject.com/cs/design/aopsimplestscenario.asp?msg=2160427&mode=all&userid=3765364#xx2160427xx
http://www.codeproject.com/csharp/aspectintercept.asp?msg=2145384&mode=all&userid=3765364#xx2145384xx
Both use ContextBoundObject in their implementations. It seems that both solutions suffer from the same problem. Method injection does not work when a method is called from inside its own class. Something like this.
/***Will properly call pre and post methods*****/
MyClass myClass = new MyClass();
myClass.CallMethod();
/***Will not call pre and post methods*****/
this.CallMethod()
Has anyone else run into this problem? Am i going down the wrong path? Is there a better solution to the problem?
|
|
|
|
|
Not sure if it's what you are looking for, but have you looked at the Policy Injection Block in the latest Enterprise Library release?
http://www.codeplex.com/entlib[^]
only two letters away from being an asset
|
|
|
|
|
Hi folks-- first post
I'm encountering timeouts when opening URLs to a long-running webpage. It's actually a web service of sorts; the url returns an XML-encoded query result. The problem is that the result is pretty big and can take more than a minute to run. The C# program fails with an exception related to the timeout.
XmlReader reader = XmlReader.Create("http://theserver/thequery?param=1");
The problem is, I can't figure out how to adjust the timeout. That setting is in one of the hidden classes that XMLReader wraps (possibly System.IO.Stream.ReadTimeout or .CanTimeout), but I there doesn't seem to be a way to get to it to change or turn off the timeout.
Help??
|
|
|
|
|
May you should change tactics then. Use a WebRequest and create the XmlReader after the results have been returned.
only two letters away from being an asset
|
|
|
|