|
|
hi this is ravi, i need code for setting our own timimgs in datetimepicker control rather than automatic.
regard ravi
|
|
|
|
|
hi!
I have to convert sqlserver database(table) to an excel file.I tried some code samples available.In some code samples,excel is used as namespace i.e. using excel is mentioned.but I am not able to compile it.please help me if you have any code to convert sql server tables to excel.
Thanking you ,
with regards,
srikanth.
mvssrikanth
|
|
|
|
|
hi!
I have to convert sqlserver database(table) to an excel file.I tried some code samples available.In some code samples,excel is used as namespace i.e. using excel is mentioned.but I am not able to compile it.please help me if you have any code to convert sql server tables to excel.
Thanking you ,
regards,
srikanth.
mvssrikanth
|
|
|
|
|
How do I declare a "Graphics g" inside this event handler?
Graphics g = new Graphics(); //DOESN'T WORK...
private void complexA_OK_Click(object sender, System.EventArgs e)
{
//Want to instantiate a Graphics object here....
}
thanks -- sorry, I know it's a stupid question....if you just want to tell me how dumb I am don't bother responding...
|
|
|
|
|
Write somthing like Graphics g=this.CreateGraphics(); this will get graphics object from the form the event handler belong
if you for example you want to draw in Picture box write
Graphics g=pictureBox1.CreateGraphics();
if you want to Draw on the image to get graphic write
Bitmap bm=new Bitmap(x,y);
Graphics g= Graphics.FromImage(bm);
MCAD
-- modified at 20:42 Friday 2nd September, 2005
|
|
|
|
|
thanks Mohammed, I will try it...
|
|
|
|
|
first of all sorry about my english, but it's all what I have
so, that's the question.
In all controls in the form in properties window (in the bottom right) appears
(DataBindings). What is this and how to use it? I heard that is helps to separate all stuff about how controls react for user's action. I mean, if user click checkbox some text field can be disabled.
|
|
|
|
|
I'm trying to determine the ip assigned by ISP.. so far I've thought of no direct way.. Is there a simple way to get your ip thru c#? not the 192.168.?.? I'm talkin about the external IP... I will continue my search but any links, pointers, similar frustrations would help a bunch
aspiringCodeMonkey says ...
|
|
|
|
|
There is no way of getting the external ip directly. It simply does not exist in the computer.
You have to send a request outside the local network so that the ip number can be detected and sent back to you. For this you need a server that will return the ip number to you.
There are a lot of pages out there that will tell you what ip address you are using. Like Aspsidan/IP[^]. You can use a page like that to get the ip number in the response. Ideal for you would be a page that returns only the ip number in plain text, and nothing else.
---
b { font-weight: normal; }
|
|
|
|
|
|
This is what I want to do:
<br />
abstract class Item<br />
{<br />
abstract Item(int x, int y)<br />
{<br />
x = X;<br />
y = Y;<br />
}<br />
}<br />
class Transistor : Item<br />
{<br />
Transistor(int X, int Y)<br />
{<br />
x = X;<br />
y = Y;<br />
}<br />
}
But it wont work.
How could I solve it?
I got an idea on how to do it...
Like this:
<br />
abstract class Item<br />
{<br />
abstract Item(int x, int y)<br />
{<br />
x = X;<br />
y = Y;<br />
this.init();<br />
}<br />
}<br />
class Transistor : Item<br />
{<br />
init(int X, int Y)<br />
{<br />
}<br />
}
But isn't there a better way?
Niklas Ulvinge aka IDK
|
|
|
|
|
Are you trying something like this?
abstract class Item {
public Item(int x, int y) {
}
}
class Transistor : Item {
public Transistor(int x, int y) : base(x, y) {
}
}
|
|
|
|
|
The incomplete code that you show doesn't tell me what it is that you want to do.
Can you explain what it is that you are trying to accomplish?
---
b { font-weight: normal; }
|
|
|
|
|
I thought I needed to create an instance of item, wich I didn't have to and couldn't do...
I simply removed the construcor and it worked fine.
Thanks for your replies.
I'm tired and can't think really well now, but now is the only time I can program, (at other times it's only homework, school and more homework).
Niklas Ulvinge aka IDK
|
|
|
|
|
best practices of Microsoft recommends the following:
abstract class Item {
protected Item(int x, int y)
{
...
}
}
class Transistor : Item
{
public Transistor(int x, int y) : base(x,y)
{
}
}
Eduardo Diaz
site | english blog | spanish blog
|
|
|
|
|
That was what I'm looking for, thanks
Niklas Ulvinge aka IDK
|
|
|
|
|
I encountered the following problem and I am confused now. I'm sure that cunning foxes are around to help me.
Take this code:
<br />
object o = new object(); <br />
o = 1;<br />
<br />
double dValue = (double) o; <br />
The cast doesn't work and the error message comes up: An unhandled exception of type 'System.InvalidCastException' occurred.
Thanks in advance!
Chris
|
|
|
|
|
object o = new object();
o = 1;
double dValue = Convert.ToDouble(o);
Live Life King Size
Alomgir Miah
|
|
|
|
|
You are boxing an integer into an object. You can only unbox it as an integer:
(int)o
After you have unboxed the value, you can convert it to a double:
double dValue = (double)(int)o;
If you want to store a double in the object, you have to specify that the value is a double:
o = 1d;
---
b { font-weight: normal; }
|
|
|
|
|
Sounds reasonable - thanks for your replies!
Cheers,
Chris
|
|
|
|
|
Here is a class to dial, hangup, and test the internet connection being used.
Paul R. Johnson
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
namespace ComServer_Business_Logic
{
public class Dialer
{
[System.Runtime.InteropServices.DllImport("wininet.dll", EntryPoint="InternetGetConnectedState", ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true)]
private static extern bool InternetGetConnectedState(ref Int32 lpdwFlags, Int32 dwReserved);
[System.Runtime.InteropServices.DllImport("Wininet.dll", EntryPoint="InternetDial", ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true)]
private static extern Int32 InternetDial(IntPtr hwndParent, string lpszConnectoid, Int32 dwFlags, ref Int32 lpdwConnection, Int32 dwReserved);
[System.Runtime.InteropServices.DllImport("Wininet.dll", EntryPoint="InternetHangUp", ExactSpelling=true, CharSet=System.Runtime.InteropServices.CharSet.Ansi, SetLastError=true)]
private static extern Int32 InternetHangUp(Int32 lpdwConnection, Int32 dwReserved);
private enum Flags: int
{
//Local system uses a LAN to connect to the Internet.
INTERNET_CONNECTION_LAN = 0X2,
//Local system uses a modem to connect to the Internet.
INTERNET_CONNECTION_MODEM = 0X1,
//Local system uses a proxy server to connect to the Internet.
INTERNET_CONNECTION_PROXY = 0X4,
//Type Visual Basic 6 code here...
//Local system has RAS installed.
INTERNET_RAS_INSTALLED = 0X10
}
//Declaration Used For InternetDialUp.
private enum DialUpOptions: int
{
INTERNET_DIAL_UNATTENDED = 0X8000,
INTERNET_DIAL_SHOW_OFFLINE = 0X4000,
INTERNET_DIAL_FORCE_PROMPT = 0X2000
}
private const int ERROR_SUCCESS = 0X0;
private const int ERROR_INVALID_PARAMETER = 0X87;
private Int32 mlConnection;
public string GetConnectionType()
{
Int32 lngFlags = 0;
if (InternetGetConnectedState(ref lngFlags, 0))
{
//connected.
if ((lngFlags & (int)Flags.INTERNET_CONNECTION_LAN)!=0)
{
//LAN connection.
return "LAN connection.";
}
else if ((lngFlags & (int)Flags.INTERNET_CONNECTION_MODEM)!=0)
{
//Modem connection.
return "Modem connection.";
}
else if ((lngFlags & (int)Flags.INTERNET_CONNECTION_PROXY)!=0)
{
//Proxy connection.
return "Proxy connection.";
}
return "Not connected.";
}
else
{
//not connected.
return "Not connected.";
}
}
public void Connect()
{
Int32 DResult = 0;
DResult = InternetDial(IntPtr.Zero, "My Connection", Convert.ToInt32(DialUpOptions.INTERNET_DIAL_UNATTENDED), ref mlConnection, 0);
if (DResult == ERROR_SUCCESS)
Console.WriteLine("Dial Up Successful");
else
Console.WriteLine("UnSuccessFull Error Code");
}
public void Disconnect()
{
Int32 Result = 0;
if (! (mlConnection == 0))
{
Result = InternetHangUp(mlConnection, 0);
if (Result == 0)
Console.WriteLine("Hang up successful");
else
Console.WriteLine("Hang up NOT successful");
}
else
Console.WriteLine("You must dial a connection first!");
}
}
}
|
|
|
|
|
Paul R. Johnson wrote:
Here is a class to dial, hangup, and test the internet connection being used.
This would more appropriately belong as an article submission.
|
|
|
|
|
Sorry,
I am not sure how to write an article and submit it. It was code that I was struggling with, and I finally got it to work correctly.
I saw that others were having problems with the same results, so I just wanted to help out.
Paul
|
|
|
|
|
can some one help me with this project plzz
Standard telephone keypads contain the digits 0 through 9. The numbers 2 through 9 each have three letters associated with them.
Many people find it difficult to memorise phone numbers, so they use the correspondence between digits and letters to develop eight-letter words that correspond to their phone numbers. For example, a person whose telephone number is 4263-7663 might use the correspondence in Table 1 to develop the eight-letter word “HANDSOME” so that people can easily remember his phone number. Each eight-letter word corresponds to exactly one eight-digit telephone number. A delivery service could surely do so with the number 3354-8379 (i.e., “DELIVERY”).
Each eight-digit phone number corresponds to many separate eight-letter words. Unfortunately, most of these represent unrecognisable juxtapositions of letters. It is possible, however, that the owner of a barber shop would be pleased to know that the shop’s telephone number, 4247-2888, corresponds to “HAIRCUTS”. A hospital with the phone number 4677-4825 would be pleased to know that the number corresponds to the letters “HOSPITAL”. A body shop owner would be pleased to know that the shop’s number, 2639-7467, corresponds to “BODYSHOP”.
Write a C program that, given an eight-digit number, writes to a file every possible eight-letter word combination corresponding to that number. There are 6561 (38) such words. Avoid phone numbers with the digits 0 and 1.
Digit Letter
2 A B C
3 D E F
4 G H I
5 J K L
6 M N O
7 P R S
8 T U V
9 W X Y
|
|
|
|