|
I am currently creating a plugin for Visual Studio .NET. This plugin is to help database entry. When the plugin is running I want to be able to select a file, right click it, and have a menu of options to be able to do with this particular file. Any suggestions on helping how to do this? I am using the MVP model for coding.
|
|
|
|
|
hello all,
Finally I could able to save my dynamic array data into text file. But it is not formated it is saving as a big line. I want to format my data into
9 X 9. Can anyone help me please.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
Dim cellValue As String, i As Integer
Dim returnValue As Boolean
Dim FileWriter As StreamWriter
Dim results As DialogResult
results = SaveFileDialog1.ShowDialog
If results = DialogResult.OK Then
FileWriter = New StreamWriter(SaveFileDialog1.FileName, False)
For r As Integer = 1 To 3
For rr As Integer = 1 To 3
For c As Integer = 1 To 3
For rc As Integer = 1 To 3
cellValue = xx(r, c).rec(rr, rc).Text
returnValue = String.IsNullOrEmpty(cellValue)
If returnValue = True Then
FileWriter.Write("00 ")
Else
FileWriter.WriteLine(cellValue + " ")
End If
Next
i += 1
Next
Next
Next
FileWriter.Close()
End If
Me.Close()
End Sub
I am getting my output like this
8
00 00 00 00 00 00 00 00 00 7
00 13
00 17
00 21
00 00 00 1
00 53
00 51
00 00 00 3
00 00 00 00 00 27
00 00 00 79
00 00 00 49
00 00 00 75
00 00 00 00 00 31
00 00 00 73
00 45
00 47
00 00 00 67
00 63
00 41
00 35
00 00 00 00 00 00 00 00 00 00
but I want to format like
00 00 00 00 00 00 00 00 00
00 07 00 13 00 17 00 21 00
00 00 01 00 53 00 51 00 00
00 03 00 00 00 00 00 27 00
00 00 79 00 00 00 49 00 00
00 75 00 00 00 00 00 31 00
00 00 73 00 45 00 47 00 00
00 67 00 63 00 41 00 35 00
00 00 00 00 00 00 00 00 00
modified on Thursday, September 17, 2009 9:33 AM
|
|
|
|
|
so choose carefully between Write() and WriteLine().
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
If I wrote both write() I am getting a big horizontal line
It I choose writeline() I am getting a vertical line
I don't know how to write a break line for output format
|
|
|
|
|
there are basically two ways for starting a new line:
- outputting a string containing Environment.NewLine
- using WriteLine with some argument; even an empty string would work.
Did you loose all the documentation? Is google defective? how about reading an introductory book on programming?
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Ok, everyone is complaining about you not knowing how to use Write() and WriteLine(), when the real problem is a simple tweak to the algorithm.
1) Get rid of the WriteLine() part in the innermost block... Only use Write() there
2) Right before the second-to-last next (As the last statement in the "For rr" loop, add FileWriter.WriteLine() . That's where you start processing the next line, so that's where you want the line break.
|
|
|
|
|
Thank you very much especially to Ian shlasko you made my day Have a nice day
|
|
|
|
|
Hi all,
I've been researching how to upload a file to a web server. I've found lots of articles about it (most here at CodeProject), but I'm having some problems with my code. Everytime I run the code I get the following error:
The remote server returned an error: (404) Not Found.
My Code:
Dim responseArray As Byte()
Try
Dim WC As New System.Net.WebClient
responseArray = WC.UploadFile("http://someserver/Uploads/upload.aspx", "POST", "\myfile.doc")
txtResponce.Text = "Check the file at " + Encoding.ASCII.GetString(responseArray)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
What I don't understand is what "upload.aspx" is there for. There is never any code to go with it, so I'm not sure what it's there for.(MSDN has this same example, no code to upload.aspx). I've taken the "upload.aspx" out and I get the same error.
I've given the ASPNET and ISS user accounts read/write access to the folder, so I'm sure it's not a permission problem. Can ANYONE explain what I'm doing wrong?
|
|
|
|
|
upload.aspx would be the webpage that would accept your file.
The 404 error means you are trying to communicate to a server (or a document on a server) that does not exist.
|
|
|
|
|
Ok, I finally figured it out. There is a property called Request.Files , It holds all of the data on the files that are being uploaded to that page. You can then loop through it and save the files to the web server.
Code for anyone interested:
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Me.Request.Files.Count <> 0 then
Dim I As Integer
For I = 0 To Me.Request.Files.Count - 1
Me.Request.Files.Item(I).SaveAs("C:\some\path\Uploads\" & Me.Request.Files.Item(I).FileName)
Next
End If
End Sub
End Class
I'm not sure that's the best way to go about it, but it works! I think I may write up an article about this as I couldn't find this information easily ANYWHERE.
|
|
|
|
|
Hi all,
I have written code as
Dim Plist() As System.Diagnostics.Process
Plist = System.Diagnostics.Process.GetProcesses("MySystemName")
Plist(0).Handle.ToString() is saying "Access Denied"
if I use
Plist = System.Diagnostics.Process.GetProcesses("127.0.0.1")
it is saying that "Feature is not supported for remote machines."
How to get the Handle of the each Process ?
Ramesh Sambari
Knowledge is like honey.
Collect it, to make life sweet.
|
|
|
|
|
You may not have sufficient rights. Try to run this code under an account with administrative rights and it will run fine.
Tosch
modified on Thursday, September 17, 2009 8:21 AM
|
|
|
|
|
Hi all,
I want to Know if there is a built in function that takes two dates and retun full date ex(01/02/2000 - 01/01/2000 = 0/1/0)
thanks for help
|
|
|
|
|
No, because that makes no sense, 0/1/0 is not a date. You can use the datetime functions to subtract two dates and get the difference in years, months or days (and times too), but you would need to format it yourself.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
hi,
I need to generate and display a lengthy word document where the contents are generated dynamically using code(Visual Basic 6.0).
so i have used word.selection.type .
My Problem is , if the user opens word document during the dynamically generation of wrd document the contents are printed in the opened document (ie current selection gone to the newly opened document by the client)
what to do
|
|
|
|
|
Your solution could be found in the following steps:
1. forget VB6
2. forget VB6 again
3. Download Visual Studio 2008 Express from Microsoft (it's free)
4. Create an example word document with all the necessary formatting and elements.
5. Save the document as an xml document
6. Open the xml document with Visual Studio
7. Use Visual Studio to create an empty copy of the xml document into a string and then fill in the dynamic content.
8. Save the string into a file, and save the file as [YourFileName].doc
This is just one possible solution. But I do warmly recommend to follow steps 1 and 2 at any rate.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Sorry, I didnt understand the 6 and 7 th point. i dont have much idea in Visual Studio 2008 .
one more clarification:
I have to bring to work only by using Visualbasic 6.0..is this will provide the solution to work with vb 6.0
|
|
|
|
|
The basic idea is to build a string, and save it to a file.
Point 6 can also be done with a (free) text editor like for example PSPad[^]
Point 7 can also be done in VB6. Look at what the xml file looks like, and have your code build a string exactly like it. So for example:
Dim MyFileContent As String
MyFileContent = "<someXMLelement>Some dynamic content here </someXMLelement>"
In the end the file will be built in memory, so it can not be accidentally opened while it is still being written.
This gives you some added advantages:
- You will able to run your application, and write the documents, on a PC or server without needing MS Office.
- This method will make the document version independent, so a user can open it, no matter which version of MS Office they have.
- You could build in some email functionality, and send the document to someone's email instead of storing it.
- Or you could instead store the document on a server or network storage media, so you won't have to install your application on each user's PC separately.
Finally, you really need to consider why your work wants you to use VB6. There are no good reasons. Anything that it can do, can be accomplished much easier with VB.NET. The editor (Visual Studio 2008 Express) for VB.NET is free, and makes writing code 100 times easier, compared to whatever editor you use to write VB6 code. It is much much easier to debug, and it will take you 2 weeks tops to get used to.
VB6 is outdated, not supported anymore by Microsoft, and you will not find many people who can help you with it.
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hello all
My project will be run with a tought screen and am trying to make a keyboard in vb
can anyone guide me in the right direction i search on google and did not fin anyting helpfull
Thanks
|
|
|
|
|
I've done this before. Basically, I took a graphic of a keyboard, brought it up whenever the user focused on a textbox ( I used a derived class to do this ), and passed the textbox that had the focus whenever the keyboard came up. Then whatever you pressed, I passed on to the textbox. The main thing is to remember to support backspace and delete. You can add a key to clear it, too, if you think that makes it easier to use.
What touch screens do you use, out of curiosity ? HP has some sweet ones now.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I dont remeber what kind of touch screen i have i got it out of a cafe its a 15" lcd works good I will look at the hp screens i want to get a bigger one
do you have a sample of code to get me started ?? Please
Thanks
|
|
|
|
|
I was planing on using a bunch of button and putting code in each one for each letter
|
|
|
|
|
Well, I can't give you the code, b/c I don't own it, my work does. But rather than a bunch of code at the button level, what I did was find a single graphic of a keyboard, and created a map of rectangles that represented each key. On a mouse down event, I would iterate over those rects and find the one that contained the point. Then I'd look up what key that represented and go from there.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I already have pictuers for each button and i already did the layout
I tryed this
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SendKeys.Send("W")
End Sub
and this
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.Text = ("W")
End Sub
did not work
i put the curser in the text box and it go away when i click the buttin
|
|
|
|
|
Bob Beaubien wrote: i put the curser in the text box and it go away when i click the buttin
After the button click you can focus to text box which will bring the cursor back to it.
Bob Beaubien wrote: I already have pictuers for each button and i already did the layout
Putting each button for each key sounds like a terrible idea. Go with what CG suggested. That would be interesting and obvious solution here.
|
|
|
|