|
Ahmed El-Badry wrote: Msge.Visible = True
Dim date1 As Date = "8/27/2008"
Dim date2 As Date = "5/19/2008"
Dim DiffDays As Integer
DiffDays = date1.Day - date2.Day
Msge.Text = DiffDays
Who got the output of this code is No. 8 days ,This is not true
The difference between the dates is 100 days ,This is what i mean
Right you are, sorry, my fault.
Use this code:
Dim date1 As Date
Dim date2 As Date
date1 = "19.5.2008"
date2 = "27.8.2008"
Dim Diff As TimeSpan = date2.Subtract(date1)
MsgBox(Diff.Days)
but still: you asked this question before (more than a year ago).
In your CV you write, that you have fair knowlege of VB.NET. This date-stuff is very basic, usually explained in the first chapters of most beginner books.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
thnx u
Ahmed El-Badry
|
|
|
|
|
Msge.Visible = True
Dim date1 As Date = "8/27/2008"
Dim date2 As Date = "5/19/2008"
Dim DiffDays As Integer
Dim Diffmonth As Integer
Dim Diffyear As Integer
DiffDays = date1.Day - date2.Day
Diffmonth = date1.Month - date2.Month
Diffyear = date1.Year - date2.Year
Msge.Text = DiffDays.ToString + " " + Diffmonth.ToString + " " + Diffyear.ToString
outing 8 days 3 month 0 year
i want convert this to days = 100 days
Ahmed El-Badry
|
|
|
|
|
Hi,
I'm having some trouble trying to figure out a way to break up a textarea into 800 word pages. I want each page to retain its original spacing and the pages should be broken up at word boundaries so that words aren't cut up from page to page. Any suggestions would be great.
Thanks,
John
|
|
|
|
|
I guess you could count the spaces to find 800 words.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
hi smile.gif
i have the fellowing code for updating the database when its change in data grid
<br />
<br />
While (r < DataGridView1.Rows.Count - 1)<br />
InsertCommand1.Parameters.Clear()<br />
InsertCommand1.CommandText = "UPDATE [Section] SET Capacity =" & DataGridView1.Rows(r).Cells(2).Value & " WHERE SectionID = " & DataGridView1.Rows(r).Cells(1).Value<br />
<br />
InsertCommand1.CommandType = CommandType.Text<br />
InsertCommand1 = InsertCommand1<br />
DataAdapter1.InsertCommand = InsertCommand1<br />
InsertCommand1.ExecuteNonQuery()<br />
DataAdapter1.Update(DataSet1, "Section")<br />
r += 1<br />
End While<br />
it make the update but it give the fellowing error
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
when i but the fellowing command
Dim CmdB As New OleDb.OleDbCommandBuilder(DataAdapter1)
it give error in update statment
|
|
|
|
|
asha_s wrote: Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
These built in update things suck. However, if you must use them, this error is telling you that you need to specify the update command ( the SQL that does the update )
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
Christian Graus wrote: this error is telling you that you need to specify the update command ( the SQL that does the update )
how can i specify it i am sure from the type of the sended perimeter if you have another way rather than command please tell me
|
|
|
|
|
Hi to all,
PLEASE PLEASE PLEASE HELP ME, SORRY IF MY MESSAGE IS SO LONG, BUT I COULDN'T FIND A WAY TO AT LEAST UPLOAD MY CODE FILES SO I HAD TO INSERT ALL THE CODE HERE, BUT PLEASE HELP, I'M REALLYYYYYYYYY STOCKED AND I WILL BE VERY VERY VERYYYYYYYY THANKFUL IF SOMEONE HELPS ME ............
I am reading the Microsoft's book for exam 70-310 & 70-320 and I have a problem in Chapter 4's lab which I didn't manage to solve ... please help me ...
It's a simple chat application using .NET remoting:
We have a ChatCoordinator class and a SubmitEventArgs class (saved in a file named: CChatCoordinator.vb) with the following code:
---------------------------------------------------------------------
Imports System
Imports System.Runtime.Remoting
Imports System.Collections
Serializable()> _
Public Class SubmitEventArgs
Inherits EventArgs
Private message As String = Nothing
Private userName As String = Nothing
Public Sub New(ByVal contribution As String, _
ByVal contributor As String)
Me.message = contribution
Me.userName = contributor
End Sub ' New
Public ReadOnly Property Contribution() As String
Get
Return message
End Get
End Property
Public ReadOnly Property Contributor() As String
Get
Return userName
End Get
End Property
End Class ' SubmitEventArgs
Public Delegate Sub SubmissionEventHandler(ByVal sender As Object, _
ByVal submitArgs As SubmitEventArgs)
Public Class ChatCoordinator
Inherits MarshalByRefObject
Public Sub New()
Console.WriteLine("ChatCoordinator created. Instance: " & _
Me.GetHashCode().ToString())
End Sub ' New
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function ' InitializeLifetimeService
Public Event Submission As SubmissionEventHandler
Public Sub Submit(ByVal contribution As String, _
ByVal contributor As String)
Console.WriteLine("{0} says: {1}.", _
contributor, contribution)
Dim e As New SubmitEventArgs(contribution, contributor)
Console.WriteLine("Broadcasting...")
RaiseEvent Submission(Me, e)
End Sub ' Submit
End Class ' ChatCoordinator
-------------------------------------------------------------------
We have a Server class (in a file named: CServer.vb):
Imports System
Imports System.Diagnostics
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Public Class Server
Public Shared Sub Main()
RemotingConfiguration.Configure("Central.config")
Console.WriteLine("The host application is currently " & _
"running. Press Enter to exit.")
Console.ReadLine()
End Sub ' Main
End Class ' Server
--------------------------------------------------------------------
The Central.config file, which is used by the Server class for configuration is as follows (I had to delete the beginning "<" characters to avoid interception with HTML here):
configuration>
system.runtime.remoting>
application>
service>
wellknown
mode="Singleton"
type="ChatCoordinator, ChatCoordinator"
objectUri="Chat"
/>
/service>
channels>
channel ref="http" port="8080" />
/channels>
/application>
/system.runtime.remoting>
/configuration>
--------------------------------------------------------------------
And finally, we have a ChatClient class (saved in a file named CChatClient.vb):
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels
Imports Microsoft.VisualBasic
Public Class ChatClient
Inherits MarshalByRefObject
Public Overrides Function InitializeLifetimeService() As Object
Return Nothing
End Function
Private userName As String = Nothing
Public Sub New(ByVal [alias] As String)
Me.userName = [alias]
End Sub
Public Sub Run()
RemotingConfiguration.Configure("Client.config")
Dim chatCenter As New ChatCoordinator
AddHandler chatCenter.Submission, AddressOf _
Me.SubmissionReceiver
Dim userInput As String = ""
While True
Console.WriteLine("Press 0 (zero) and ENTER to Exit:")
userInput = Console.ReadLine()
If userInput = "0" Then Exit While
chatCenter.Submit(userInput, userName)
End While
RemoveHandler chatCenter.Submission, AddressOf _
Me.SubmissionReceiver
End Sub
Public Sub SubmissionReceiver(ByVal sender As Object, _
ByVal args As SubmitEventArgs)
If args.Contributor = userName Then
Console.WriteLine("Your message was broadcast.")
Else
Console.WriteLine(args.Contributor & " says: " & _
args.Contribution)
End If
End Sub ' SubmissionReceiver
Public Shared Sub Main()
Dim args() As String = Environment.GetCommandLineArgs()
If args.Length <> 2 Then
Console.WriteLine("You need to type an alias.")
Return
End If
Dim client As New ChatClient(args(1))
client.Run()
End Sub ' Main
End Class ' ChatClient
--------------------------------------------------------------------
And the Client.config used by the Client class (Again, beginning "<" characters here are deleted intentionally):
configuration>
system.runtime.remoting>
application>
client>
wellknown
type="ChatCoordinator, ChatCoordinator"
url="http://localhost:8080/Chat"
/>
/client>
channels>
channel ref="http" port="0" />
/channels>
/application>
/system.runtime.remoting>
/configuration>
--------------------------------------------------------------------
I use the VB compiler at the Command Prompt to compile the codes:
vbc /t:library CChatCoordinator.vb<br />
vbc /r:CChatCoordinator.dll CServer.vb<br />
vbc /r:CChatCoordinator.dll CChatClient.vb
and then store CChatCoordinator.dll, Cserver.exe and Central.config in a folder named Server and store CChatCoordinator.dll, CChatClient.exe and Client.config in another folder named Client.
After that, I try to run the application:
Also it appears to me that running CChatClient.exe in the Command Prompt without running CServer.exe in another Command Prompt would generate an exception, the CChatClient.exe is executed without any errors.
Because of this, I think that the program doesn't interpret the ChatCoordinator class (in the CChatCoordinator.dll file) as a remotable object and it uses it's methods regardless of whether the CServer.exe is running or not.
Although when I run CChatClient.exe, my firewall tells me that this program wants to connect at a random port becuase of port="0" in the Client.config file, It appears to me that the Client class doesn't care what the Client.config file says; because I even tried to misspell some elements in Client.config but no error was generated.
And because of all the things that I said, when I open three diferent Command Prompt windows and type these:
1. CServer (in the Server directory)
2. CChatClient user1 (in the Client directory)
3. CChatClient user2 (in the Client directory)
and then I try to send messages from one use to the other, the messages only appear in its own user window not the other user.
For example, when I type "Hello" and press enter in user1's window, only the following appears in user1's window:
user1 says: hello.
Broadcasting...
Your message was broadcast.
and nothing appears in user2's window.
Are file names important here? For example, should the Server class be inside a file named Server.vb? Is it really important? I also tried to change the configuration file names to filename.exe.config but it also didn't solve the problem.
Please help me, I searched the articles, read MSDN, and manipulated the code many many times, but I couldn't find the problem. Please help ......
modified on Monday, May 19, 2008 4:46 AM
|
|
|
|
|
hi myself cma windows application developer in vb.net. please help me
1 how to save contents of data gried veiw into files
2 how to print contents of controls in vb.net
plese provide me comleate code using vb.net only with library
mohammed
|
|
|
|
|
Noone is going to provide you with any code. You have to write that yourself. We'd be happy to help you with problems you get stuck on in your own code, but we're not going to do your work for you.
cma wrote: 1 how to save contents of data gried veiw into files
If you used a DataGridView bound to a DataTable, instead of using it in unbound mode, then saving your data to file becomes as simply as a single line of code. But, you have to setup a DataTable first, with appropriate columns to hold the data the user is entering.
cma wrote: 2 how to print contents of controls in vb.net
This is too vague to answer. What do you mean by "print contents of controls"? Are you trying to print the image of the form, complete with all the controls??
|
|
|
|
|
cma wrote: plese provide me comleate code
Urgent, isn't it?
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
cma wrote: hi myself cma windows application developer in vb.net.
I'd be inclined to suggest you're a student of VB.NET. Do you have any books ? Have you read my article on how to search google ? Did it occur to you that every post in this forum is about VB.NET, so your subject line is useless ?
To save the content, the obvious way is to use a string builder to iterate over it and build a representation of the data, then use File.WriteAllText to save it.
There is a whole printing framework in .NET, any of the articles you'd find with google would explain it in more depth than a forum reply can.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 Everyone:
I have an interesting problem. I modified a C# application written by Bob Powell that demonstrated how to move graphic primitives to Visual Basic 2005 .NET.
I want to take this a step further and be able to move alphanumeric characters around on the screen using the mouse. My problem is I can draw a series of characters using the DrawPath method, but when I point to a specific character to hit test it the application’s HitTest Function does not recognize the character. I’m guessing the problem lies in the class I created for the text, but I don’t know how to solve the problem.
I wrote to Bob Powell and he suggested using glyphs. I’m assuming he wanted me to take the fonts and convert them to glyphs. This is where I get confused; a font is just a glyph. It seems redundant to create a glyph out of a glyph.
A single font character has a height and a width. The hit test function returns those values and uses them to create a rectangle around the graphic primitive I’m pointing too. Once the primitive is highlighted I can move it elsewhere on the screen by holding down the left mouse button and move the mouse to another position on the screen dragging the highlighted primitive with it.
Does anyone have any ideas?
Quecumber256
|
|
|
|
|
I assuming the hit test fails because you can't click exactly on the drawn part of the character and not the white space inside it. You're, basically, trying to click on a very thin line and missing. I hope anyway...
I have no idea if this solution would work for you, but you already know how to click and move a graphic image, so draw the text onto a small bitmap and left the user click and drag the bitmap around.
|
|
|
|
|
Hi Dave:
Thanks for the input. The experiment I'm running uses a 50 point font, which in turn produces an image large enough to know you are clicking on the character itself.
The bitmap approch did occur to me as a possible solution, but considering the work involved producing 255 bitmaps, one for each ANSI character it didn't seem like it would be practical.
Obviously there is a fundimental difference between shapes drawn using GDI+ and how GDI+ handles fonts. There has got to be some method out there that will allow me to capture the font, but so far my searches have produced ziltch.
Quecumber256
|
|
|
|
|
Hello members,
I am planning to join VB .Net Course.Which software should i buy VS2005 standard edition or VB.Net Standard edition.
which one is the best?.
Please guide me.
thanks,
avinash.
|
|
|
|
|
When buying Microsoft programming software, I would always go with the full Visual Studio. Despite VB.NET being only for VB, the full Visual Studio allows you to switch between any programming languages with greater ease. Also, if you are taking computer programming courses, their is a great chance that you will have to use C++ as well which is included in the full Visual Studio.
You may also consider the 2008 edition unless your course absolutely requires 2005.
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[ ^]
|
|
|
|
|
thank you for your answer.this advice is really helpfull .thanks again.
I have another Question .
I already have Microsoft VC++ Express Edition 2008,Microsoft Visual Basic 2008 Express Edition,Microsoft Visual Web Developer 2008 Express Edition,Microsoft SQL Server 2005 in my computer.
I got Microsoft Visual studio 2005 standard edition now.Do I need to uninstall every thing before installing VS2008?.
Please answer.
thanks,
Avinash.
|
|
|
|
|
The first step of becoming a programmer would be, the ability to do a little research. If you were to google, you'd quickly find that 2005 and 2008 can happily co-exist. I believe tat te express editions will also work fine, I've run them on my dev box. But, why would you need them ?
SQL Server is a totally different program, and is completely unrelated.
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
2003, 2005 and 2008 can coexist on the same machine (I have VS2003Pro, VS2005Standard, VS2008Pro). The only real reason why you would need the express editions is if you were using XNA (unless it has since been changed). Before you could only use XNA on the Express Editions and not the standard or professional versions of Visual Studio.
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[ ^]
|
|
|
|
|
thanks you for the answers.
avinash.
|
|
|
|
|
Why are you asking this for a second time ?
Christian Graus
Please read this if you don't understand the answer I've given you
"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 )
|
|
|
|
|
note to cp members...dup post
|
|
|
|
|
Hello
This the first time i work in serial port class
i need to send a serial data to an external board
if any one can help me and advise me
it'll be greatfull and very helpful for me
Thanks in advance
Assaf
|
|
|
|