|
Yes, I have tried it but it won't work with SharpDevelop (the IDE that I use to code VB.net). Is there any other way?
|
|
|
|
|
If you looked at the top of that page, there's a link to the VB.NET 2005 (.NET 2.0) version of the same code. Also, the code has absolutely nothing to do with the IDE you're using. It'll still work, even if you're using Notepad to type in the code.
|
|
|
|
|
Drop this component[^] on the form that contains the rich text box, then set the extended properties for the bounding rectangle and other options and then call the FormPrintHelper1.Print method.
|
|
|
|
|
I have gridview in mine code,it has check box control. I want to fetch those rows only which has been selected by checking the check box column.
Please suggest me what I need to do.
Ashish K. vyas
-- modified at 3:44 Thursday 29th November, 2007
Ashish K. vyas
|
|
|
|
|
I use this to get the IDs (in the first column) you should be able to modify it to get the checked value from the checkbox cell
Private Sub DoReturns()<br />
Try<br />
Dim oRow As DataGridViewRow<br />
mvReturnValue = ""<br />
mvReturnValues = ""<br />
If dgData.SelectedRows.Count > 0 Then<br />
mvReturnValue = dgData.SelectedRows(0).Cells(0).Value.ToString<br />
For Each oRow In dgData.SelectedRows<br />
mvReturnValues += oRow.Cells(0).Value.ToString + ","<br />
Next<br />
End If<br />
Catch Exc As Exception<br />
Throw Exc<br />
End Try<br />
End Sub
Quote from Great Outdoors:
its a confident traveller who farts in India
|
|
|
|
|
Please read the forum guidelines. Avoid text speak. We don't care if it's urgent.
|
|
|
|
|
Hi, I'm (trying) to build an app using VB.net that will be a stand alone app. ie NOT a web based form etc.
The main reason for this is that I have a number of offline functions it will eventually do.
However, one part of the app is required to upload a file to a site via FTP and then make the file visible for others to download. There are more functions it needs to do, but essentially this is the main focus.
My problem is, i dont even know where to start to look to get an idea of how to do this. ie do I use ASP.Net, do I use AJAX or remoting??
If anyone has any suggestions or even some example code on how to manipulate a web site from a stand along App I would be forever grateful.
Ive some code to manage the File transfer, but I need to add links etc to the file/directory.
Any and all suggestions are welcome.
|
|
|
|
|
AGB11 wrote: any suggestions
Make sure you have aspirins because converting from web app to stand alone win apps are a total headache.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Currently I'm using VB.Net to perform a http/https multipart form post to a servlet. I'm able to perform the post using HttpWebrequest via GetRequestStream(). However, the servlet returned me with "The remote server returned an error: (500) Internal Server Error". Obviously, this means that I have not posted all the parameters as the servlet requested. But I just can't seem to find out what went wrong with my code. Hope someone can enlighten me, below is the code and sample form post for your reference:
VB.Net code:
Public Shared Function Send(ByVal URL As String, _
Optional ByVal Port As String = "", _
Optional ByVal Servlet As String = "", _
Optional ByVal PostString As String = "", _
Optional ByVal SSL As Boolean = Nothing, _
Optional ByVal faxfile As String = "", _
Optional ByVal faxlist As String = "")
'https handling
Dim oCertOverride As New CertificateOverride
ServicePointManager.ServerCertificateValidationCallback = AddressOf oCertOverride.RemoteCertificateValidationCallback
'set Port number
If Port = "" Then
If SSL = False Then
Port = 80
ElseIf SSL = True Then
Port = 443
End If
End If
'set the URL according to SSL
If SSL = True Then
URL = "https://" & URL & ":" & Port & Servlet
ElseIf SSL = False Then
URL = "http://" & URL & ":" & Port & Servlet
Else
Return ""
Exit Function
End If
'fax file
Dim boundary As String = "----------------------------------------AaB03x"
Dim contentLength
Dim postData2 = boundary & vbCrLf & "Content-Disposition: form data; name = ""faxfile""; " & _
"filename= """ & faxfile & """" & vbCrLf & _
"Content-Type: image/tiff" & vbCrLf & vbCrLf
Dim faxStream As New FileStream(faxfile, FileMode.Open, FileAccess.Read)
Dim faxBuffer() As Byte
ReDim faxBuffer(Math.Min(4095, faxStream.Length))
'fax list
Dim postData3 = ""
Dim listStream As FileStream = Nothing
Dim listBuffer() As Byte = Nothing
If faxlist <> "" Then
postData3 = boundary & vbCrLf & "Content-Disposition: form-data; name = ""faxlist""; " & _
"filename=""" & faxlist & """" & vbCrLf & _
"Content-Type: text/plain" & vbCrLf & vbCrLf
listStream = New FileStream(faxlist, FileMode.Open, FileAccess.Read)
ReDim listBuffer(Math.Min(4095, listStream.Length))
End If
'end boundary
Dim postData4 = vbCrLf & boundary & "--"
MsgBox(PostString & postData2 & postData3 & postData4) 'debug
'convert to bytes
Dim byte1() As Byte
Dim byte2() As Byte
Dim byte3() As Byte = Nothing
Dim byte4() As Byte
byte1 = System.Text.Encoding.ASCII.GetBytes(PostString)
byte2 = System.Text.Encoding.ASCII.GetBytes(postData2)
byte4 = System.Text.Encoding.ASCII.GetBytes(postData4)
'populate content length
contentLength = byte1.Length + byte2.Length + faxStream.Length + byte4.Length
If faxlist <> "" Then
byte3 = System.Text.Encoding.Default.GetBytes(postData3)
contentLength = contentLength + byte3.Length + listStream.Length
End If
Dim Request As HttpWebRequest = WebRequest.Create(URL)
Dim Response As HttpWebResponse
Dim ResponseData As String = ""
' Prepare Request Object
Request.Method = "POST"
Request.AllowWriteStreamBuffering = False
Request.ContentType = "multipart/form-data; boundary=" & boundary
Request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/tiff, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*"
Request.Headers.Add("Cache-Control", "no-cache")
Request.UserAgent = "http generic"
System.Net.ServicePointManager.Expect100Continue = False
Request.ContentLength = contentLength
MsgBox(Request.ContentLength.ToString()) 'debug
Dim SW As Stream = Nothing
Dim SR As StreamReader = Nothing
' Send Request, If Request
Try
SW = Request.GetRequestStream()
If SW.CanWrite Then
MsgBox("Writing header") 'debug
SW.Write(byte1, 0, byte1.Length)
MsgBox("Writing fax file") 'debug
SW.Write(byte2, 0, byte2.Length)
Dim bytesRead = 1
While bytesRead <> 0
bytesRead = faxStream.Read(faxBuffer, 0, faxBuffer.Length)
If bytesRead <> 0 Then
SW.Write(faxBuffer, 0, bytesRead)
End If
End While
If faxlist <> "" Then
MsgBox("Writing fax list")
SW.Write(byte3, 0, byte3.Length)
bytesRead = 1
While bytesRead <> 0
bytesRead = listStream.Read(listBuffer, 0, listBuffer.Length)
If bytesRead <> 0 Then
SW.Write(listBuffer, 0, bytesRead)
End If
End While
End If
MsgBox("Writing end boundary")
SW.Write(byte4, 0, byte4.Length)
End If
Catch Ex As WebException
MsgBox(" Writing Exception: " & Ex.Message)
Catch Ex As Exception
MsgBox("Writing Exception: " & Ex.Message)
Return Nothing
Exit Function
Finally
SW.Close()
End Try
' Receive Response
Try
MsgBox("Receiving data") 'debug
Response = Request.GetResponse()
'MsgBox("retrieving from site") 'debug
SR = New StreamReader(Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
MsgBox(ResponseData) 'debug
SR.Close()
Catch Ex As WebException
MsgBox("Servlet Exception: " & Ex.Message)
Catch Ex As Exception
MsgBox("Servlet Exception: " & Ex.Message)
Return ""
Exit Function
End Try
Return ResponseData
End Function
Sample multipart form post:
----------------------------------------AaB03x
Content-Disposition: form data; name="destnum"
12345678;
----------------------------------------AaB03x
Content-Disposition: form data; name="loginname"
test
----------------------------------------AaB03x
Content-Disposition: form data; name="password"
test
----------------------------------------AaB03x
Content-Disposition: form data; name="line"
1
----------------------------------------AaB03x
Content-Disposition: form data; name="faxpri"
0
----------------------------------------AaB03x
Content-Disposition: form data; name="scheduletype"
1
----------------------------------------AaB03x
Content-Disposition: form-data; name = "faxfile"; filename="C:\Users\test\Appdata\Roaming\WindowsApplication1\Application1\1.0.0.0\Microsoft Word - Document1.TIF"
Content-Type: image/tiff
follow by file content
----------------------------------------AaB03x--
Any help will be appreciated
~ amelia ~
|
|
|
|
|
I dragged and dropped a database table to my form. Then I wrote some code that is not in the designer generated code. It is a sub routine for one of my tab pages.
Here is the code.
Private Sub tabpgSettings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tabpgSettings.Click<br />
' declare variables<br />
<br />
'TODO: This line of code loads data into the 'DataSet1.tbl_hours' table. You can move, or remove it, as needed.<br />
' use the try block in case of an error<br />
<br />
Try<br />
Me.Tbl_hoursTableAdapter.Fill(Me.DataSet1.tbl_hours)<br />
Catch err As Exception<br />
MessageBox.Show(err.Message)<br />
End Try<br />
<br />
' fill the Mon - Sun combo boxes with the hours<br />
<br />
End Sub
As soon as I pasted this code into the class I went back to the form designer and the form would not come up and there were a bunch of errors instead.
Here are the errors that showed up instead of the form.
One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes.
Why does it mention this code below? The code is not on 2006, it is on line 2010.
The designer cannot process the code at line 2006: Me.DataSet1.DataSetName = "DataSet1" The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again. <br />
Hide Edit <br />
<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.CreateQuoteExpression(XmlElementData xmlElement)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.XmlElementData.get_CodeDomElement()<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.EndElement(String prefix, String name, String urn)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.Parse(XmlReader reader)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.XML.CodeDomXmlProcessor.ParseXml(String xmlStream, CodeStatementCollection statementCollection, String fileName, String methodName)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnMethodPopulateStatements(Object sender, EventArgs e)<br />
at System.CodeDom.CodeMemberMethod.get_Statements()<br />
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)<br />
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)<br />
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)<br />
at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host)
Here are the errors that showed up in the designer generated code. It says that the designer generated code was edited but I did not edit it.
The code below has a blue squigly line under "LessonProgram".
Friend WithEvents DataSet1 As LessonProgram.DataSet1<br />
Friend WithEvents Tbl_hoursTableAdapter As LessonProgram.DataSet1TableAdapters.tbl_hoursTableAdapter<br />
Me.DataSet1 = New LessonProgram.DataSet1<br />
Me.Tbl_hoursTableAdapter = New LessonProgram.DataSet1TableAdapters.tbl_hoursTableAdapter
I replaced the above lines of code with the following lines and the blue line dissapeared, but the form still wotn come up.
Friend WithEvents DataSet1 As DataSet1<br />
Friend WithEvents Tbl_hoursTableAdapter As DataSet1TableAdapters.tbl_hoursTableAdapter<br />
Me.DataSet1 = New DataSet1<br />
Me.Tbl_hoursTableAdapter = New DataSet1TableAdapters.tbl_hoursTableAdapter
Also, it said that the designer can't process the code at line 2006. This is what is on line 2006.
Me.Label61.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Has anyone ever had this happen and do you know how to fix it?
|
|
|
|
|
You said that you pasted that code into your project. Make sure that tabpgSettings's click event is attached to that sub.(form design window>tabpgSettings's properites>Events>)
Make sure you didnt delete "End Class" or "Public Class Form1"
Undo the changes you made to:
"Friend WithEvents DataSet1 As LessonProgram.DataSet1
Friend WithEvents Tbl_hoursTableAdapter As LessonProgram.DataSet1TableAdapters.tbl_hoursTableAdapter
Me.DataSet1 = New LessonProgram.DataSet1
Me.Tbl_hoursTableAdapter = New LessonProgram.DataSet1TableAdapters.tbl_hoursTableAdapter"
once you fix the first error this one will go away as well.
If that doesnt work I would press undo (Ctrl+z) about 300 times to find out what you deleted.
Its not the best advice but it will work.
|
|
|
|
|
I checked and I did not delete any code at all. In fact, no matter what I do I get these errors. I don't get these errors if I do not drag and drop a database table to the form.
Here is exactly what I am doing.
1) I drag and drop a data base table to the form from the Data Sources window which adds the TableAdapter etc to the form.
2) If I type any code -- OR -- hit the enter key so that I can type code after a comment -- OR -- put a ' before some code to make it a comment or type any code at all I get these errors.
I even downloaded SP1 for Visual Basic Express 2005 and it did not fix the errors.
Does anyone have any idea at all what is causing this error?
Are there any known bugs with adding tableAdapters using Visual Basic Express 2005?
Is there anyone else out there that is having this same problem?
|
|
|
|
|
Im trying to load a Crystal Report I've made in Visual Studio to a Crystal Report Viewer on my form. I used the "database expert" to add the connection (ODBC RDO) to my Access 2007 database. The database has no password on it.
The Visual Studio field explorer detects all the fields correctly from my command ( SELECT * FROM Table1; ) so I know it can connect to the databse.
The problem is when I run the program I get prompted for the Logon ID and Password and every time I get "Logon Failed. Please Try Again." Again there is no password on this DB.
All of my code (this is a test project)
Imports CrystalDecisions.CrystalReports.Engine
Form Load:
Dim crpt As New ReportDocument()
Dim rPath As String = "C:\CrystalReport1.rpt"
crpt.Load(rPath)
CrystalReportViewer1.ReportSource = crpt
|
|
|
|
|
Are you supplying it with the right log in credentials? Or have you not been required to do so?
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
|
|
|
|
|
I thought that was handled by the ODBC RDO.
As I said it can connect to the DB when Im in the Crystal Report Design window but when I run the program it prompts for a Logon ID and Pass but there is no need for this info to make a connection.
I read that setting "Persist Security Info" on the connection is supose to fix this but I'm unsure how to apply this setting.
|
|
|
|
|
Do I have to open and close the database connection when using TableAdapters like I would with DataAdapters?
|
|
|
|
|
Hi,
No, TableAdapters will manage this for you!
regards,
|
|
|
|
|
I am writing a VB.net application. I learned using dataAdapters and the configuration wizard in Visual Basic 2003, but I am using VB 2005 to write my program. Being I am using 2005 I used the wizard to create a TableAdapter. Then I created a module to declare some variables in because I have multiple forms in the application.
Here is my problem.
After I declared the variables in the module I am not able to use .Fill in my forms to Fill the DataTable.
When I create a TableAdapter do I also have to create a DataTable?
Here is the variable declarations I am using in the module.
' declare variables<br />
Dim dataSet As New DataSet1()<br />
Dim hoursTableAdapter As New DataSet1TableAdapters.tbl_hoursTableAdapter()
Here is the code I am trying to use to access the TableAdapter (from within one fo the forms), but when I use it I get the blue squigly line under the code. The blue squigly line shows up under "Me.hoursTableAdapter" and "Me.DataSet".
Me.hoursTableAdapter.Fill(Me.DataSet.tbl_hours)
How do I access the TableAdapter?
I tried Importing the namespace from the table adapter as well. Here is the code I used to import the namespace. I put it before the class declaration.
Imports lessonProgram.DataSet1TableAdapters
|
|
|
|
|
I figured out the problem. I had to drag and drop the table from the Data Sources tab.
|
|
|
|
|
Hi,
I am making a HTML Editor in VB.NET using a WebBrowser as a WYSIWYG Editor. This is the code I use:
Me.WebBrowser1.Document.DomDocument.designMode = "On"
That works fine, and I also use exccommand to allow movement of elements, etc. My problem is that no matter what I rty, I cannot make HTML table cells/rows/columns resizable, and I cannot make the user able to select multiple cells. This doesn't happen even if I use a normal webbrowser not in designmode! I know that this is possible because most WYSIWYG editors, eg frontpage, expression web, allow you to do all this, but I just cannot figure out how to manage it in my application.
Does anyone know a way of doing any of these things with a WebBrowser in VB.NET? I don't mind if i only get an answer to one of the above.
Conor
|
|
|
|
|
Hi there...
I got a bit of a problem with coloring text between two given words. Here's an example:
I have a RichTextBox with the following text:
This is a RichTextBox with some random jibberish bla bla bla i just need to make it long enough.
Next, i have two other textboxes with the following text in the first textbox:
with
and in the second textbox:
jibberish
Below that, i have two more textbox with the following text in the first:
just
and in the second textbox:
long
Now when your press a button, i want the text between those words colored red, so that result will be like this:
Click here to see the required result
As you can see, the text between the given words are colored red.
I need this so i can colorize error messages in my app. My app handles somekind of compilation process and at the end it shows the compile log of the compilation process to the user. If the log has errors, i want to make the error messages red, so that it is easy to find.
Now there are many different kinds of error messages that can pop up during this compile process, so i need to find a way to handle all those error messages (making them red) with as less code as possible. Perhaps an Array will do the job?
Can anyone help me with these issues? I hope you guys understand what i need.
http://www.themightyatom.nl
|
|
|
|
|
General strategy might be to loop through each of the words in the long string. When the first word of the desired red string is found then find the position in the string of the first letter of that word and remember it. When the second word is found then find the position of the last letter of that word. At this point select the text between the first position and the second position and color it red... then continue.
I noticed that you can't repeat the same word as the first or last word in the desired string or you'll get a problem.
for instance:
"I want to have this code be the selected code" (in red)
"I, code" creates a problem
cs
|
|
|
|
|
Uhm... ok. Ill try it out but i don't think ill be able to get it to work though. This is kinda difficult.
http://www.themightyatom.nl
|
|
|
|
|
I'd suggest doing anything like colouring when you're adding the text to the control, not afterwards. Then it's much easier to identify the string you're adding, so you don't have to search for words or worry about whether the 'end words' in your error message will be found somewhere else in the control and make your code 'find' the wrong stuff.
I'd also suggest using a new line for each message, and maybe starting the lines with some standard bit that indicates whether they're errors, warnings, or something else.
This would identify the errors by something other than colour, which is often a good idea.
If "rich text" includes tables, then 'message type' could be column 1 and the detail would go in column 2.
|
|
|
|
|
Hmmm, to tell you the truth, im not really sure if i can do all that, im still a beginner Vb'er, you see. This sounds kind of advanced and difficult (for me that is).
Maybe you can provide me with an example or something that i can work out?
Ill include your name in my app when i release it.
http://www.themightyatom.nl
|
|
|
|
|