|
Put the Value of Date in DateTime Variable
Then U can easily deduct date value
Like
Dim var_date as datetime
Var_date = "2/13/2008"
var_Date = Var_Date.days - 3
Anubhava Dimri
9250168195
anubhava.prodata@gmail.com
|
|
|
|
|
hi friends..
How to draw grid dots using graphics (like autocad) and i want to differentiate the grid point when the cursor is in grid point(like the grid point blinks).. How can i do this ..
|
|
|
|
|
hi all,
I am a beginner in C#. I want to Send and receive files through parallel port. Since i am working in Windows 2000 Professional, I used Inpout32.dll for parallel port access. I used 0x378(data register)(888) for sending and 0x379(status register) for receiving. I can send data as 1 byte . But on receiving side, data received is different.
Eg: If i send 1 , i will get ---- as 136
for 2, i wil get 144.
for 15 - i wil get 0.
Does anyone can help........?
Thanks
Anez.A
|
|
|
|
|
Hi,
Some of the status inputs are inverted...
Here is a link showing which ones are.
http://www.doc.ic.ac.uk/~ih/doc/par/[^]
Also... there only appears to be 5 inputs... so how can you receive 8 bits (1byte).
Matthew Butler
|
|
|
|
|
Thanks Matthew.....
then, how would i get the data?
i wan to get the data i sent. On sending, we send as 8bits.(1 byte).
How can we receive tat data using 5 bits?
any idea...?
Please help yar..........
Once again Thanks..................
Anez.A
|
|
|
|
|
If your are using a DB-25 port then...
According to Wikipedia... (Quote)
<br />
Monodirectional parallel ports<br />
In early parallel ports the data lines were monodirectional (data out only) so it was not easily possible to feed data in to the computer. However, a workaround was possible by using 4 of the 5 status lines. A circuit could be constructed to split each 8-bit byte into two 4-bit nibbles which were fed in sequentially through the status lines. Each pair of nibbles was then re-combined into an 8-bit byte.<br />
The general idea with parallel ports is that you only send 'Data' in one direction (away from the computer) and only send back status bits.
When you receive data it shouldn't go 'into' a parallel port, it should be read (all 8 bits) onto the controller (microcontroller etc) port.
When sending data back, 4 bits of the controller's port should be connected to four of the status bits (see wiki page) and then the fifth status bit could be used to say which nibble (half-byte) is being sent.
To summarise...
The computer (the master) has 8 bits output, and 4 (or 5) bits input.
The device (the slave) will have as many pins as needed (8 bits receive, 4 (or 5) bits send).
You need to send data from the slave to the master in two (half-byte) sections.
[Also: Is there any particular reason why you are using parallel ports? (Serial is really simple to use)]
Hope this helps.
Matthew Butler
|
|
|
|
|
Thank u dear...
as u said, serial is better. But i used to transfer data between an instument and Computer via parallel port(Since interface provided by the instrument is Parallel Port (db 25 pin connector), i have to use this port for data transfer)...
Once again,
thank u for ur reply
|
|
|
|
|
hi friends..
I am doing my coding in console application... How to add images to tool strip menuitem without giving the image path like
Image im = Image.FromFile(@"C:\\Local Files\\VisualStudio Projects\\new.bmp");.....Can any one know help me....i want to create image form itself(like resource file in visulstudio)...
|
|
|
|
|
i have a dataset which is having all the records of a table from a database....now i want to insert all those record(which is in dataset) into a table(with same name and same fields) but to another database...how can i do this please help me...
|
|
|
|
|
use bulkcopy
Hope this will help u
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
How do I find a memory leak in C#, I have several hundred datatables I load data to. On shutting these datatables down I do not reclaim all the memory it used while loading, I probably loose about 50% of my memory.
Thanks in advance,
Michael
|
|
|
|
|
Try .Net Profiler.
http://www.microsoft.com/downloads/details.aspx?FamilyID=a362781c-3870-43be-8926-862b40aa0cd0
|
|
|
|
|
Hi,
I declare various objects to be available in a form immediately in the class declaration eg
public partial class MainForm : Form
{
int totalCourts;
int totalViewPeriods;
int totalBookingPeriods;
int minimumBookingPeriods;
etc...
What I want to do is declare objects conditionally ie if a variable = say 9 then make an object available. Specifically I want to make tableadapters made at design time to be available at runtime.
Is there some way to make these available in the Form Load event?
Glen Harvy
|
|
|
|
|
Your best bet is to make the object available via a property which can throw an exception or return null if you don't want it to be available.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello
It seems really impossible to programaticaly assign values to a binded datagridview. In the following example I'm trying to renum a column value
The result is unpredictible : some values are assigned, some not ?
Some are reflected to the binded dataset but not all ?
private void Rit_Renum()
{
int Step;
int Order = 1;
int.TryParse(txb_renum.Text, out Step);
if (Step < 0) Step = 1;
dgv_rit.Columns["order1"].SortMode = DataGridViewColumnSortMode.NotSortable;
Order = 1;
for (int i = 0; i < dgv_rit.Rows.Count; i++)
{
if (dgv_rit.Rows[i].Cells["order"].Value == null) break;
dgv_rit.Rows[i].Cells["order1"].Value = Order;
Order += Step;
}
dgv_rit.Refresh();
}
I start with a sorted list 1 to 12
I swap a few contiguous rows values
(11 = 12, 12=11) then sort
(10=11, 11=10) then sort
(9=10, 10=9) then sort
So now the original row 12 have the value 9 and the position of 9
Then I renum with a step of 3
The result is this ??
1
3
4
6
7
9
10
12
16
22
28
34
Does anyone undersdand what happen !
|
|
|
|
|
Generally, databound controls tend to blow up if you try to change or add to them. You should change your datasource to change the values.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thank you
Indeed !
That was my conclusion !
But why does it works for manual entry ?
|
|
|
|
|
How do you mean ? Why does it work when the control is not bound ? Because it's not refreshing itself to a datasource. Why does it work sometimes ? I suspect because you don't know when it will rebind. All I know for sure is that it's safer not to do what you're doing.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello
Ok I will try to do everyting directly on the datasource
Here is what I do
1- open a connection
2- Select sql from a db table
3- Fill a dataset
5- set dataset as datasource of DGV
6- Let user modify values in ONE column (my order column)
I have two way to modify values
a)- Manually
b)- Automaticaly (with renum ond reorder function)
For now a) and b) are applied directly to DGV, I will manage to do automatic modification on the datatable
AFTER : I apply change to db with getchanges
I use the same connection with different adapter and I close it when the user close the application.
Does it sounds right to you ?
|
|
|
|
|
I'm trying to open a serial port and just leave it open while my whole program is running. I don't need to write to it, I have a relay that activates when the port opens. I can open the port and everything is always fine for a while until the port closes at different times. This powers down my test equipment and ruins my test.
Can anyone tell me why the port closes? This is what I Do:
SerialPort port = new SerialPort("COM4", 9600, Parity.None, 8, StopBits.One);
// Open the port for communications
port.Open();
It stays open for anywhere between 3 and 4 minutes.
|
|
|
|
|
Is it an USB - ComPort adapter ?
|
|
|
|
|
It is a USB Commport Adapter. I have an older machine that has a real serial port. I'll try it on that one.
Could it be a problem with the USB device?
|
|
|
|
|
|
DateTime date = File.GetCreationTime(Application.ExecutablePath).AddDays(12);
stillHasTime = (date >= DateTime.Now);
I use this code to cause a demo version to expire after 12 days. We've tested it many times and it works great, but we have two users who are reporting that they got asked to register after two days. Can anyone tell me any reason why the creation time of an app that has never been installed on the PC before, would be out by 10 days ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Stupid question... What does the OS think the current creation date is for the file? It may not be your code! Its possible that something changed this value.
Hogan
|
|
|
|