|
Hi,
I followed your advice (Eddy) with notepad++, setting the filter to "*.*" and searching for "My.Settings.UserSource_Path", because in initialization it's "nothing" which isn't a searchable string. I only get results from 2 vb-files, not even the settings.settings and settings.designer files of which I know they have the string in them.
So this approach didn't help... Still can't find out why it's nothing instead of the project properties entry.
Thank you though,
Mick
|
|
|
|
|
Sonhospa wrote: Still can't find out why it's nothing instead of the project properties entry. It is probably using settings from another location, with default values.
Are you by any chance on a network where the users' home folders are mapped to a network drive?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello Eddy,
sorry for the late response, I didn't have access to programming stuff for a few days.
While my VS2010 projects are on the "E:" harddrive, the user's folders (pictures, videos etc) are mapped to "F:\Media" on the same computer (separate harddrive). No network connections.
I wonder what would cause such a twist... you seem to have an idea... Btw I'm under Win7-64bit.
|
|
|
|
|
|
Hello,
sorry again for the late response. With the help of your links (i.e. the articles) I was at least able to eliminate older/probably competing settings files and put most of the code into a new project which is running.
Thank you for the advice, Eddy!
I wish you a merry Christmas and a happy new year.
|
|
|
|
|
You're welcome. Merry Christmas and happy new year to you also
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello to everyone,
it might sound funny, but in a current project "suddenly" (i.e. I don't know what I exactly did) the references to "My.Settings" didn't work anymore. Instead, I had many errors saying that "Settings" isn't a property of "My".
What I did: I opened a completely new (winforms-) project and looked into the files having "My.Settings" (etc) in their text, and adapted my project files "app.config", "settings.settings" and "settings.designer" (manually inserting the properties) to the syntax and entries I saw in the new (sample) project.
First I thought it's ok: All the error messages disappeared. But when debugging, I can see that my settings references (e.g. "My.Settings.UserPath") only supply empty strings. This implies to me that the valid entries must be out of the valid scope (or something like that), i.e. I must have overlooked something... typos are checked.
Could one of you please advise me, where else I might look for errors or what else I could do?
Thank you very much in advance,
Mick
|
|
|
|
|
Go to PROJECT -> Properties on the VS menu. Or right click on the project in the Solution Explorer window and select Properties. You should then be able to navigate to the Settings section.
|
|
|
|
|
Thank you, Richard - but both methods work normal and I see the usual page with my user settings.
The problem occurs when "InitializeComponent" calls
Private _userSourcePath As String = My.Settings.UserSourcePath <--------------
Public Property UserSourcePath() As String
Get... which is called by , returns an empty string instead of the actual settings entry.
I think I must have made an error when manually editing the mentioned files. For example, I don't know where I would place the Namespace reference in "app.config" or in the settings files.
Any other idea?
|
|
|
|
|
Sonhospa wrote: Any other idea? Sorry, no. But I would certainly not recommend manually editing these files, as it is too easy to make a mistake that does not show up until you try running the code. I can only suggest you recreate your project and settings via Visual Studio.
|
|
|
|
|
Thank you though, Richard.
Finally I found the problem: The file "settings.designer.vb" had it's first part of the code (where the properties are defined) wrapped into "Namespace My"/"End Namespace". Obviously that's not right and lead to wrong references / empty string.
Now it works again !
Have a nice day,
Mick
|
|
|
|
|
In a vb.net 2010 application, I am trying to determine the best way to accomplish this goal.
Write now 1 letter is generated and sent to one guardian. However this application needs to be
changed so that the same exact letter can be send to different mailing addresses since each student may have more than one parent/guardian at different mailing addresses. So basically I want to generate more than one letter with the same wording. The only differences between the letters would be the mailingaddresses. I want the letters to be written to the same varchar(max) column in a sql server 2012 database. The letters will be in the same field since the data will be sent to a sql server reporting server where the letters will be generated one after each other.Right now the letters are written to the 'Dim _al As Letters = New Letters()' object. The only way I know to modify text data is to use a string or stringbuilder objects. I do not know yo modify data is other objects. Basically I want to use a string.replace logic to replace the addresses in the second letter. I also want to use
stringbuilder.append to place more than one letter following another to be placed in the osne varchar(max) field.
I know I can use the following code to convert a custom object to a string.
Dim _LetterStr As String = String.Empty
Dim _LetterStrbldr As StringBuilder = New StringBuilder
_LetterStr = _Letter.Letter.ToString()
However I do not know how to convert a string object back to a custom object.
Here is the original code of the application:
#Region "Protected Sub btnSubmitModifiedLetter_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles btnSubmitModifiedLetter.Click"
Protected Sub btnSubmitModifiedLetter_Click(ByVal sender As Object, ByVal e
As System.EventArgs) Handles btnSubmitModifiedLetter.Click
Dim _al As Letters = New Letters()
Dim _infinteCampusText As String
Dim _Letter As Letter = New Letter()
Dim _startDate As DateTime = Now()
Dim _term As Integer = 0
_Letter.SchoolYear = _schoolyear
_Letter.Term = _term
_Letter.Milestone = ddlMilestone.SelectedValue
_Letter.SchoolNumber = Right("000" & ddlSchools.SelectedValue,3)
_Letter.Printed = "Y"
_Letter.Letter = reLetterEditor.Content
_Letter.StudentLink = Right("0000000" & txtStuLink.Text, 7)
_Letter.Language = txtLanguage.Text
_infinteCampusText = _al.BuildText(_Letter)
_al.InsertData(_Letter, _infinteText)
btnProcessSelections.Visible = False
gvLetters.DataSourceID = String.Empty
gvLetters.DataBind()
gvLetters.Visible = False
Response.Redirect("letter.aspx?schoolyear=" +
_Letter.SchoolYear.ToString() + "&schoolnum=" +
_Letter.SchoolNumber.ToString() + "&term=" +
_Letter.Term.ToString() + "&milestonecode=" +
_Letter.Milestone.ToString() + "&startdate=" + _startDate.ToString() +
"&enddate=" + DateAdd(DateInterval.Day, 1, Today()).ToString() +
"&language=ALL&studentlink=ALL")
End Sub
#End Region
Thus can you show me the code to convert a string object to a custom object and/or show me code on how to accomplish my goal?
|
|
|
|
|
Why would you need to do such a conversion? All you need is a template that contains the main text of your letter, a _Letter object that contains the different properties (name, address etc), and a subroutine that formats the data into its printed form.
|
|
|
|
|
Would you show me an example of the code you are referring to? How should I convert a string object to a custom .net object?
|
|
|
|
|
Quote: How should I convert a string object to a custom .net object? No idea, the question does not really make sense, since String is already a .NET object.
|
|
|
|
|
|
I'll attempt to answer your question, but if it were me, I think I would re-design this solution. Do you really need to store the letter in the database ? Maybe create a template letter, give it a unique document ID, then you could store multiple records with the student ID, template ID and sequence number.
To answer your question ...
Create a class and call it LetterDetail; at a minimum it would have a string to store the letter.
Create another class and call it MailedLetters; this would contain a List(Of LetterDetail)
The second class gives you the ability to have as many letters as you want grouped together.
Within the second class, you would need 2 methods, Save and Load. This would serialize the object to an XML string which you could then save in the database.
I'll give you some rough code for serialization ...
Public Shared Function Load(sFname As String) As MailedLetters
Dim xr As XmlReader
Dim settings As XmlWriterSettings = New XmlWriterSettings()
settings.Indent = True
settings.IndentChars = (ControlChars.Tab)
settings.OmitXmlDeclaration = True
Dim obj As New MailedLetters
Dim mySerializer As New XmlSerializer(obj.GetType)
xr = XmlReader.Create(sFname)
obj = mySerializer.Deserialize(xr)
xr.Close()
xr = Nothing
Return obj
End Function
Instead of serializing to a file, you want to serialize it to a string.
Sub Save(sFname As String)
Dim xw As XmlWriter
Dim mySerializer As New XmlSerializer(Me.GetType)
Dim settings As XmlWriterSettings = New XmlWriterSettings()
settings.Indent = True
settings.IndentChars = (ControlChars.Tab)
settings.OmitXmlDeclaration = False
xw = XmlWriter.Create(sFname, settings)
mySerializer.Serialize(xw, Me)
xw.Close()
End Sub That's the best I can do for you, hope it helps.
|
|
|
|
|
Hi We are calling the webservice function from vb script by using "MSSOAP.SoapClient30", the function returns the byte array and we are saving that as *.jar file below is the sample code
============================================================
sAdminSOAPUrl = "http://testapp.com:80/test/ecs/webservices/AdminService?wsdl"
Dim vaData
Set soapClient3 = CreateObject("MSSOAP.SoapClient30")
Call soapClient3.MSSoapInit(sAdminSOAPUrl, "AdminService", "AdminService")
soapClient3.ConnectorProperty("EndPointURL") = sAdminSOAPUrl
vaData = soapClient3.exportDeployment("test","test","test_data")
If (IsArray(vaData)) Then
rgData = vaData
WScript.Echo rgData
sFilename = sPath & "xplbio.jar"
hFile = FreeFile()
Open sFilename For Binary As #hFile
Put #hFile, , rgData
Close #hFile
Dim fso As New FileSystemObject
fso.CopyFile sFilename, sPath & sExportName & ".jar"
fso.DeleteFile sFilename, True
End If
============================================================
now we are trying to use the "MSXML2.ServerXMLHTTP.6.0" instead of "MSSOAP.SoapClient30" but facing issues while writing the response into *.jar file and its being corrupt.
we have tried by channging the respose header as below but facing the same issue
"Content-Type", "text/xml; charset=utf-8",
"Content-Type" "multipart/form-data",
"Content-Type" "application/x-www-form-urlencoded",
is there any thing which I am missing please suggest, below is the sample updated code
==============================================================
' Namespaces.
Dim NS, NS_SOAP, NS_SOAPENC, NS_XSI, NS_XSD
NS_SOAP = "http://schemas.xmlsoap.org/soap/envelope/"
' Creates an XML DOM object.
Set DOM = CreateObject("MSXML2.DOMDocument.6.0")
' XML DOM objects.
Dim Envelope, Body, Operation, Param
Const URL = "http://testapp.com:80/test/ecs/webservices/AdminService?wsdl"
' Creates the main elements.
Set Envelope = DOM.createNode(1, "soap:Envelope", NS_SOAP)
DOM.appendChild Envelope
Set Body = DOM.createElement("soap:Body")
Envelope.appendChild Body
' Creates an element for the exportDeployment function.
Set Operation = DOM.createNode(1, "exportDeployment","")
Body.appendChild Operation
' Creates an element for the exportDeployment parameter
Set Param = DOM.createNode(1, "username","")
Param.Text = "test"
Operation.appendChild Param
Set Param1 = DOM.createNode(1, "password","")
Param1.Text = "test"
Operation.appendChild Param1
Set Param2 = DOM.createNode(1, "deploymentName","")
Param2.Text = "test_data"
Operation.appendChild Param2
DIM test
Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
XMLHTTP.Open "POST", URL, False
XMLHTTP.setRequestHeader "Content-Type", "multipart/form-data; User-Agent: SOAP Sdk"
XMLHTTP.setRequestHeader "SOAPAction", URL
XMLHTTP.send DOM.xml
' Loads the response to the DOM object.
DOM.LoadXML XMLHTTP.responseXML.xml
' XML DOM objects.
Dim NodeList, Element, vaData
' Searches for the exportDeploymentReturn object, which contains the value.
Set NodeList = DOM.getElementsByTagName("*")
For Each Element in NodeList
If Element.tagName = "exportDeploymentReturn" Then
vaData = Element.Text
Exit For
End If
Next
If (IsArray(vaData)) Then
rgData = vaData
WScript.Echo rgData
sFilename = sPath & "xplbio.jar"
hFile = FreeFile()
Open sFilename For Binary As #hFile
Put #hFile, , rgData
Close #hFile
Dim fso As New FileSystemObject
fso.CopyFile sFilename, sPath & sExportName & ".jar"
fso.DeleteFile sFilename, True
End If
====================================================================
|
|
|
|
|
This might be old thread (8 month) but since nobody answered...
I don't know if this will fix your issue, but this part is wrong:
XMLHTTP.setRequestHeader "Content-Type", "multipart/form-data; User-Agent: SOAP Sdk"
replace with
XMLHTTP.setRequestHeader "Content-Type", "multipart/form-data"
XMLHTTP.setRequestHeader "User-Agent", "SOAP Sdk"
setRequestHeader accept only 1 new header at the time and add it to the stack. When the request is sended, the header are "ordered" (for exemple, User-Agent is sent to top of list) see:
[https://msdn.microsoft.com/fr-fr/library/ms536752(v=vs.85).aspx]
|
|
|
|
|
Good Afternoon,
I have a problem with the focus control(set focus) after showing the dialogs form, can you help me to resolve it ?
Example code:
Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Form2.ShowDialog()
End Sub
after i show the second form, i can't set focus on a textbox in first form when the second form is closed. i used this code..
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
form1.textbox1.focus
End Sub
Help me please.....Thx
|
|
|
|
|
Me.Close()
How do you think the code on this form will continue to run after the statement above?
See Richard Deemings explanation(s)
modified 13-Nov-16 3:29am.
|
|
|
|
|
The code in the same procedure will continue to run, as will any code in the Closing and Closed event handlers.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, but the code in question is not in either of those places.
|
|
|
|
|
Yes it is.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
form1.textbox1.focus
End Sub
Calling Close on the previous line won't prevent the second line from executing.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's a button click event, not a Closing or Closed. I just ran a simple test (added a MessageBox.Show after) and although the debugger continued in the method after the call to Close , the MessageBox did not get displayed.
|
|
|
|
|