|
Thanks, Dave. And looking at the build action, seems like the library has to be on the development machine, too.
And, do I only need the .tlb file for the target application?
Bobby
modified 28-Oct-14 17:39pm.
|
|
|
|
|
Tlb's are for COM objects ... you may need to register the reference on the other computer... look into regsvr32
Kris
|
|
|
|
|
Thanks, Kris. The library will already be registered on the client. I'll see how it goes.
Bobby
|
|
|
|
|
Hey all!
I am new to VB.Net, but have extensive knowledge in Event/Procedural Programming. I am looking for ideas on a useful application, that can help me gain more understanding of syntax and general procedures. Anyone have an idea of something I can build, as a local application with data storage? I have used Pervasive PSQL database, but have not used MySQL or SQL Server. Pervasive uses PSQL scripting language, which is generally the same as SQL. Maybe something simple that uses flat files for data storage? Just need a direction to start in.
Brian Lefler
Programmer/Analyst
|
|
|
|
|
How about a gas mileage tracker? A table for cars, a table for fill-ups, UI to enter data, etc.
P.S. I was just looking at a page for Pervasive PSQL, but it's unclear what it is. I see no articles about it here on CP. If you have experience, maybe you'd like to write up something about it.
modified 25-Oct-14 16:20pm.
|
|
|
|
|
Great! Thanks. I was trying to figure out how to use an xml document to store the data, but cannot find any examples that use the same class methods to both create, and modify existing documents. I found references to xmlWriter for creating the XML, and xmlDocument to modify existing. I am trying to find something that will give an example to say;
Dim filepath as String = "C:\TestXML"
If File.Exists(filepath) = False) Then
'I need to know best practice to create the file here. What class, methods, etc...
Else
'I need to know best practice to edit the existing file. I mainly need an example of how to add
an additional node name/value pair here.
Endif
Is this something you can help with, or maybe provide an example? I appreciate everything.
|
|
|
|
|
|
Thank you for the article list. Unfortunately, none of them answer the question of, after initial creation of the XML, how can I add additional nodes, and/or edit existing nodes. I am working on a user/password manager.
So, I have a form with textbox/labels representing "ID", "Title", "User", "Pass", "Notes". I also have a "Save" button. On the save button, if the file doesn't exist, create it. (I know how to create the file from scratch.) If the file exists already, how do I traverse to the end of the node set, and add an additional node, with each of the name/value pairs mentioned above. Does anyone have an example of this?
Thank you in advance.
Also, I have a datagridview that I will use to display all existing records. I can tackle this at a later time though. I thought maybe I could use the load sub, to load the existing xml (if it exists) into the dgv. Use the form controls to maintain the values in the dgv. At the unload of the program, delete the xml, and create from scratch, based on values from the dgv. Is that a good method? Below is an example of the xml output I hope to accomplish:
<LIMGRTable>
<Record>
<ID>1</ID>
<Title>Facebook</Title>
<User>MyUserName</User>
<Pass>P@ssword</Pass>
<Notes>My Notes Here</Notes>
</Record>
<Record>
<ID>2</ID>
<Title>Gmail</Title>
<User>soandso@gmail.com</User>
<Pass>P@ssword</Pass>
<Notes>My Notes Again</Notes>
</Record>
</LIMGRTable>
Brian Lefler
|
|
|
|
|
Sorry I don't have an actual example, I just did a search for "XML + VB.NET", you may need to do further searches to find samples that help to answer your question. You should also understand that storing passwords in a text file is not a good thing to do, as anyone can get at them. Passwords should be hashed so that they cannot be read, or even decrypted, before being saved.
|
|
|
|
|
Thank you for your response. I am not actually building an app that I will active store actual passwords in. This is just an attempt to learn more of the VB.Net Language. Thank you again.
|
|
|
|
|
I never did get any good or practice these in the past, I can't even remember what there called
But I know it's a if then else statement.
Just wondering if someone could translate this for me to vb, or help me with the keywords to look up a tutorial on this.
context.Request.Url.Port == 80 ? string.Empty : ":" + context.Request.Url.Port
|
|
|
|
|
I think I got it, it may be a tenary Operator
If(m_Context.Request.Url.Port = 80, String.Empty, ":" & m_Context.Request.Url.Port)
|
|
|
|
|
Keep in mind that there is no direct replacement in VB.NET for C#'s ternary operator.
What you have may work, but there is a problem. Since IF() and IIF() are both methods, ALL arguments being passed to them are evaluated. This is not true in the C# operator.
For example, if you have C# code that reads:
string value = someObject.someProp == 0 ? myObject.prop + "something" : otherObject.prop
What if myObject is null when someObject.someProp does not equal 0? In C#, this wouldn't be a problem because the first return value (between the ? and colon) does not get evaluated when the statement is executed.
In the VB.NET version of the code:
Dim value As String = If(someObject.someProp = 0, myObject.prop + "something", otherObject.prop)
will throw an exception because you can't return the prop property on a Nothing object (myObject ).
|
|
|
|
|
Dave Kreskowiak wrote: Since IF() and IIF() are both methods, ALL arguments being passed to them are evaluated.
Not true - the IF operator[^], added in .NET 3.5, is directly equivalent to the C# ternary operator.
Your comment is true for the old IIF function[^], but that's not what the OP is using.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ah, it might help if I read the documentation again, wouldn't it!
|
|
|
|
|
It always helps!
For instance, I hadn't realized that the IF operator also has a two-argument version which is the equivalent of the null-coalescing operator (?? ).
But then, since I don't use VB.NET, it doesn't really affect me.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
So I'm good to go Richard?
I'm using 4.0
|
|
|
|
|
|
Yes, your converted code is correct.
Depending on what the code is doing, you might want to look at the UriBuilder class[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
It's for my ckEditor file browser program, sort of a plugin, in which I have to calculate the physical path of the image file and the virtual path, and pass it back to ckEditor.
This is the last part of the original vision for my eCommerce software that I started 6 years ago in vb or asp.net. It's almost done, been working on it for over 200 hours.So with this program, you can build a template in your web browser, save it as a job, and book the job and email it out to your mailing list, using the web service that I built.
I'll look at the URI article today, and see if I can use some of the knowledge from it.
Thanks for listening, and helping me out. I really appreciate it.
'Get the Domain name of the website
Dim m_urlPrefix As String = String.Format(
"{0}://{1}{2}{3}",
m_Context.Request.Url.Scheme,
m_Context.Request.Url.Host,
If(m_Context.Request.Url.Port = 80, String.Empty, ":" & m_Context.Request.Url.Port),
m_Context.Request.ApplicationPath
)
|
|
|
|
|
You could replace that code block with:
Dim m_urlPrefix As String = New Uri(m_Context.Request.Url, m_Context.Request.ApplicationPath).ToString()
That will return the same value for HTTP requests, and fix the minor bug with HTTPS requests, which use 443 as the default port.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I haven't done the 443 check yet, in which it will run in production mode on 443.
OK, I think I'll take your work on it.
|
|
|
|
|
Oh, Wait!
The final url is for a email campaign, in a port 80 environment. So regular people will be viewing the final url of the image, and wont be 443. Mail browsers and Outlook type programs will be using the URL.
|
|
|
|
|
Please I have DatagridView bound to a DataTable that pulls records and displays the DataGridView correctly. Now, I have ColumnType as DataGridViewComboBoxColumn of the forth column named "Username". When I click the combo box of the DataGridview, nothing gets displayed at all. I just don't understand it. Below is the code.
<pre lang="vb">
'Objects already initialized
Dim QueryU As String = "select * from Users where username='" & frmUsers.txtUsername.Text & "'"
Dim daUser As New SqlDataAdapter(QueryU, SQLCon)
Dim dtUser As New DataTable
daUser.Fill(dtUser)
If dtUser.Rows.Count > 0 Then
Dim c4 As New DataGridViewComboBoxColumn()
c4.HeaderText = "Send To"
c4.Name = "Username"
c4.DataPropertyName = "Username"
c4.DisplayMember = "Username"
c4.ValueMember = "Username"
c4.DisplayStyleForCurrentCellOnly = False
c4.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
c4.FlatStyle = FlatStyle.Popup
c4.SortMode = DataGridViewColumnSortMode.Automatic
c4.DataSource = dtUser
c4.Width = 300
frmUsers.DataGridView1.Columns.Add(c4)
Catch
End Try
End If
</pre>
|
|
|
|
|
Benniiit wrote: Dim QueryU As String = "select * from Users where username='" & frmUsers.txtUsername.Text & "'"
Your code is vulnerable to SQL Injection[^].
NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|