|
how about e.KeyChar.CompareTo(" "c) ?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I would always use Keys.Space, and not a space or ASCII code. I would use char.isalpha to test against a-z, also.
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 )
|
|
|
|
|
another technique:
Private Sub Txt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Txt.KeyPress
If Char.IsLetter(e.KeyChar) OrElse Asc(e.KeyChar) = Keys.Space Then
'allow
Else
e.Handled = True
End If
End Sub
|
|
|
|
|
I am using VS 2005 .NET 2.0
I have added a application config file, which contains 2 keys for my application. The config file named appTextSearch.config is created in my application's folder.
Now, the problem is I am not able to read these 2 values from the config file.
serverDetails (see below) returns nothing
ConfigurationManager.AppSettings.HasKeys also returns false
DO I need to specify anywhere in my application to read this application config file ?
</configuration>
<appSettings>
<add key="servername" value="http://a2tmon963:9080/gisgazetteerhttp/addressformatted.do?freeText=" />
<add key="recno" value="30" />
</appSettings>
</configuration>
Dim serverDetails As String = ConfigurationManager.AppSettings("servername")
Dim NoToReturn As String = ConfigurationManager.AppSettings("recno")
|
|
|
|
|
There shouldn't be a "/" in the first <configuration>
|
|
|
|
|
Sorry this was a typo. There is no "/" in the first configuration
|
|
|
|
|
It works fine for me then. Do you have a reference to System.Configuration in your Project?
|
|
|
|
|
I do have a reference to System.Configuration
To clarify, I am working with a class library DLL. I realise this is probably why I cannot read the app.config. Does anyone know any way around this problem ??
|
|
|
|
|
Use the following XML:
</configuration>
<appSettings>
<key>"servername"</key>
<value>"http://a2tmon963:9080/gisgazetteerhttp/addressformatted.do?freeText=" </value>
</appSettings>
<appSettings>
<key>"recno"</key>
<value>"30"</value>
</appSettings>
</configuration>
|
|
|
|
|
Hello,
I am looking for a solution to use like we had in VB 6 a Command control array.
I need to put +- 20 commandbuttons on a form with the same program code.
The buttons need to have all a different text coming out of a database. The color of every button is can be different to set also out of a data base.
It is for a hotel registration so i need to show the room nrs each on every button , when the room is occupied the button need to be red otherwise green. After clicking on a room nr the bill of that room comes up ,........
I just dont know how i can have a control array like in VB6.
Any suggestions are most welcome.
Thanks
Didier
|
|
|
|
|
There are many solutions Here:[^]
|
|
|
|
|
|
Thanx to everybody that has given me a link to the solution.
It works.
Thanks
Didier
|
|
|
|
|
Hi , I try to start a Shell application using Process, I give the rigth path but i beleive
Source code
Dim compiler As New Process
compiler.StartInfo = New ProcessStartInfo()
compiler.StartInfo.WorkingDirectory = "C:\Program Files\Firebird\Firebird_1_5\bin\"
compiler.StartInfo.FileName = ("gbak.exe")
compiler.StartInfo.Arguments = " -g -b -z -v ""C:\GDBCreation\SV1020_012Br21.GBB"" ""C:\GDBCreation\SV1020_012Br21.Data"" -user ""SYSDBA"" -password "" poupi"""
compiler.StartInfo.UseShellExecute = False
compiler.StartInfo.RedirectStandardOutput = True
compiler.Start()
Console.WriteLine(compiler.StandardOutput.ReadToEnd())
when i execute nothing happen, the console appear for one seconde and desapear.
Help me
|
|
|
|
|
there are one or two problems:
1.
fritzdjam wrote: compiler.StartInfo.Arguments = " -g -b -z -v ""C:\GDBCreation...
if you need to have a literal double quote, you would need to write \" inside
your literal string
2.
Process.Start() launches a process but does not wait for it to finish (not even to start);
so it tries and reads the results immediately, and finds none. You must wait before calling
ReadToEnd(), using one of WaitForInputIdle, WaitForExit, or HasExited.
Read up on the Process class!
-- modified at 11:35 Friday 23rd November, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: 1.
fritzdjam wrote:
compiler.StartInfo.Arguments = " -g -b -z -v ""C:\GDBCreation...
if you need to have a literal double quote, you would need to write \" inside
your literal string
Not true in VB.NET. VB doesn't support the \ character as an escape character. He has to use two double-quotes to get one inside the string.
|
|
|
|
|
Sure. I keep forgetting that. Maybe I should actually write some VB lines as a penitence?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Nah. I'll just take a rewrite of Notepad using LOGO.
|
|
|
|
|
You're so cruel.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
Sub pd_Printpage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)
Dim linesPerPage As Single = 0
Dim yPos As Single = 0
Dim leftMargin As Single = ev.MarginBounds.Left
Dim topMargin As Single = ev.MarginBounds.Top
Dim line As String = Nothing
' STAMPA INTESTAZIONE
IntestazionediPagina(yPos, leftMargin, topMargin, ev)
count = 14 + 1
printFont = New Font("Courier New", 10, FontStyle.Regular)
' Calculate the number of lines per page.
linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics)
' BEGIN READ FILE
Do Until EOF(Numfile)
' Print each line of the file.
If count < linesPerPage Then
FileGet(Numfile, RigoOrdine)
line = Rigo(RigoOrdine)
yPos = topMargin + count * printFont.GetHeight(ev.Graphics)
ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos, New StringFormat)
count += 1
ElseIf Not line Is Nothing Then
ev.HasMorePages = True
'IntestazionediPagina(yPos, leftMargin, topMargin, ev)
Exit Sub
Else
ev.HasMorePages = False
End If
Loop
End Sub
When generates the second page the text is written on the first page
Tks
Fulvio
|
|
|
|
|
The very same PrintPage event handler gets calle donce for every page printed until the e.hasMorePages is not true.
This means that variables which track the current position of the text and also reading of the text from the file has to happen outside that event handler.
I have some articles on printing that show this being done - suggest you look at the "Printing a datagrid" one as it handles flowing over multiple pages.
|
|
|
|
|
I am creating a VB.NET windows application and am unsure at whether i should be publishing the final executeable or creating a install/deployment project.
I have tried the publish route (both to a web url and a directory) and the program installs fine. However i want to control where the exe file is sent and the publish does'nt seem to give me that.
Is this what the install/deployment route will give me?
Or is there a valid reason for using one over the other?
(Yes, i am a .NET newbie)
Regards
|
|
|
|
|
Don't repost the same question multiple times. If there's additional information you need to provide, just Modify your original post.
|
|
|
|
|
Dave Kreskowiak wrote: Don't repost the same question multiple times.
Oh gawd, another one of those
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|