|
As Javed alluded to, inserting string data into a db requires Double Quotes.
-- modified at 4:13 Saturday 4th February, 2006
|
|
|
|
|
Ok I've looked all over the place here and on other forums and surpprizingly I can't find this anywhere.
How do I get the IP Address my browser is at right now and display it in my addressbar (a.k.a TextBox1)?
Thanx for any help you can give me.
|
|
|
|
|
There are two answers to this depending on what you are really looking for:
First, the really ipaddress can be obtained from the DNS object in the framework. you textbox assignment would look something like: text1.value = system.Net.Dns.GetHostByAddress.tostring()
However, if you are doing asp.net, you may really desire what the url adress bar "server" name is for example:
http://www.codeproject.com/script/comments/user_reply.asp
the server name is "www.codeproject.com" which can be applied to a textbox like so: text1.value = page.Request.ServerVariables ("SERVER_NAME")
Hope that helped.
do you need to investigate an online backup[^] company
|
|
|
|
|
Hi Jason,
Yes what I'm looking for is to display the full http:// address that one sees in the browser address bar. I'm creating a very simple web browser and the address bar (Textbox) works fine but when I click on a page link to another link I would like to display the address in the same address bar. Will your second example work for this? And is there more to the code to do this then just putting your example to the textbox I have?
-- modified at 1:35 Saturday 4th February, 2006
|
|
|
|
|
... The second example will only work if you are working in Asp.net (thus providing a webpage to a client through a browser) as you are creating a "simple web browser" I am sure that the second concept will not function like you want.
When the user of your application clicks on a link within the document that you are presenting to them, why not just copy that link to your addressbar_textbox.value?
do you need to investigate an online backup[^] company
|
|
|
|
|
Hi Jason,
After looking around I was able to find exactly what I was looking for. This is what I've got now that works really well.
'Make the Url_Address bar display the url your at.<br />
Private Sub AxWebBrowser_NavigateComplete2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event) Handles AxWebBrowser.NavigateComplete2<br />
URL_Address.Text = AxWebBrowser.LocationURL<br />
End Sub
Thanks for your help.
|
|
|
|
|
Hi. Is there a way to programmatically copy the contents of a .GIF (or .BMP) into the Clipboard directly from code?
Here is what I want to do:
1) use custom data markers (transparent GIFs) in Excel charts - scatter plot
2) copy contents of .GIF from within MS Access (or Excel) code and then "Paste"
onto/into my data series in Excel chart.
3) I want to avoid code in Excel so that I don't get "Enable macros?"
when I launch from Access (VBA code).
I have MS Access 2000 driving chart templates that reside in Excel (.xls) file. I can manipulate Chart Objects already from Access code, but still learning other "Excel" chart methods/properties.
Excel help says you can use a picture for a custom marker if you copy the image and then paste onto selected data series items - a MANUAL process.
Any help or direction would be appreciated.
Thanks,
Johnny
|
|
|
|
|
What you are looking for is called Excel Automation. Although I have not done exactly what you are talking about here, the Excel DOM (document object model) is extrmely robust, and most likly contains the functions to preform this programmatically.
To start, copy your source excel file, and record your "maunal" orocess as a macro. After stopping the macro, open the VBA editor, within excel, which will have a function that performs your "manual" process. Copy this function into your Access code base. Viola you are 90% done.
Lastly, you will have to create the excel object to run your external macro. A good example is found here: http://www.mvps.org/access/modules/mdl0006.htm[^].
The line discussing the create object code is what you really care about!...
Set objXL = CreateObject("Excel.Application")
Hope this helped
do you need to investigate an online backup[^] company
-- modified at 19:05 Friday 3rd February, 2006
Also take a look at:http://www.codeproject.com/com/ComExcelImages.asp[^]
|
|
|
|
|
Awesome! I totally forgot about (didn't even think of) using "Record Macro" and then see what went on.
Yes, you're right, that will get me the majority of what I need and then the rest is "left to student."
Thanks. (any others?)
Johnny
|
|
|
|
|
I want to show some data in an excel like grid. Is there a table control in vb6?
thanks,
sb
|
|
|
|
|
If I recall correctly, it is called a flex grid.
do you need to investigate an online backup[^] company
|
|
|
|
|
Hi guys
I have a windows form with some textboxes, a datetimepicker, a checkedbox and a numericupdown, all of them binded to a bindingsource, when i add a new record (bindingsource.addnew()) a new row appears and the textboxes are empty (its OK), the datetime picker keeps the value from the previous record, and when i save the record (without modifying the datetimepicker), a new row is inserted but with null value in the datefield, the same happens for the checked box and numericupdown (they kkep the value from the previous record), and if they are not modified, a null value will be inserted.
I know i could assign a value to datetimepicker.value=now, and so on for the other 2 controls, but is there any way to insert records with the values on those controls (no matter if i changed them or not)?
Ive aldo tryed: bindingsource.resetbinding and bindingsource.resetcurrentitem, none of them does what i need
Thanks in advance
|
|
|
|
|
I can finially get the database file to copy where I want it too. But since file copying is a lengthy process I would like to show the user the progress of the file copy underway.
How can we task that to a ProgressBar control?
Code Sample:
Dim fs
Dim lngNumberChar As Long
Dim strPath As String
Dim strSourcePath As String
Dim strTargetPath As String
Dim strDbName As String
Dim strDbFileName As String
'set the target path for file coping
strTargetPath = drvList.Drive & "\" & strDefaultFolder & "\" & strDB
'set the path for making the Archive folder on the specified drive
strPath = drvList.Drive & "\" & strDefaultFolder
Set fs = CreateObject("Scripting.FileSystemObject")
'Retrive working database from INI file
strDbName = Space(256)
lngNumberChar = GetPrivateProfileString("Database", "strDBName", "", _
strDbName, 255, App.Path & "\Cosmo_VB.ini")
strDbName = Left(strDbName, lngNumberChar)
'Set the source path for file coping
strSourcePath = App.Path & "\" & strDbName
'Does the Archive folder exist on the specified drive?
If fs.FolderExists(drvList.Drive & "\" & strDefaultFolder) Then
'Yes, Overwrite the existing backup with the latest one
strDbFileName = Dir(strSourcePath)
If UCase(strDbFileName) = "COSMO_VB.MDB" Then
fs.CopyFile strSourcePath, strTargetPath, True
End If
Else
'Create the folder on the specified drive
fs.CreateFolder (strPath)
dirList.Refresh
dirList.Path = strDefaultFolder
strDbFileName = Dir(strSourcePath)
If UCase(strDbFileName) = "COSMO_VB.MDB" Then
'Copy the database file into the specified target path.
fs.CopyFile strSourcePath, strTargetPath, True
End If
End If
Quecumber256
|
|
|
|
|
Since the CopyFile method you're using to do the work doesn't (and will never) report back any progress, you can't really make a ProgressBar work. You'll never know how much progress has been made or how much is left.
There are several ways around this, none of them "simple".
1) Implement your own copy function. You'll have to get the file size, open the source file for Shared Read, read the contents in chunks, write them to the new file, and after every chunk, fire an event that notifies about the progress.
2) Use the Shell's File Copy function. This will show the normal copy operation dialog that you get when you drag and drop files in Explorer. The downside to using this is the user can cancel the copy. The upside is it does it's own ProgressBar.
3) Implement a ProgressBar that doesn't progress, but instead "spins". There is no 100%, but there is at least something to show that something is going on. See this[^] article on MSDN for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave,
This application was built with very novice users in mind. Therefore option 2 is the best bet. Can you point me in the proper direction for the Shell File Copy?
Thank you,
Quecumber256
|
|
|
|
|
Interesting development. I tried to use the FileCopy like this:
FileCopy strSourcePath, strTargetPath
I received this error Run time error '70' Permission denied. I'm assuming that because I have the source database open it won't allow me to copy it. Am I right?
Thank you,
Quecumber256
|
|
|
|
|
More than likely. The database is probably opened by the driver DenyShareAll, which means you can't get at it until the database is closed. That means all open connections must be closed before you can copy the .MDB file. Either that, or you don't have the proper permissions to write to the detination folder...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The filecopy worked fine using the FileSystemObject. I'm copying to a Jumpdrive so there is no write deny permissions there.
Is there a way to show a message box saying "PLease wait..." that will be shown on the screen until the filecopy is completed and it will then close?
Thank you,
Quecumber256
|
|
|
|
|
All you have to do is create a simple form for this. Just put a label on the form that says "Please wait...". Remember to turn off the control box an remove the minimize, maximize buttons. Show the form, do your copy, kill the form.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Option 2 is also the hardest to implement. You'd be calling the Win32 API function SHFileOperation . The problem is that there are not very many examples of calling this using VB.NET, that are readable anyway. There's a TON of VB6 examples though, Google[^], but the code would have to be rewritten to work with VB.NET.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello!
I have received the following error message when I try to execure the given procedure below. If you have any idea, please enlight me about it!
Thanks!
BJ
A call to PInvoke function 'VSEssentials!VSEssentials.SoundPlayer::GetShortPathName'
has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Private Function GetDosPath(ByVal LongPath As String) As String
Dim Temp As String
Dim z As Int32
Dim ch As Char
Dim PathLength As Int32
z = LongPath.Length + 1
Temp = New String(ch, z)
PathLength = GetShortPathName(LongPath, Temp, z) <--- That is where the error occurs
GetDosPath = StripPath(Temp)
End Function
|
|
|
|
|
Your Declare statement for GetShortPathName is incorrect. This is common if you were looking at VB6 code and copied and pasted the Declare into your VB.NET code. This is usually because a Long in VB6 is a 32-bit singed integer, while in VB.NET the Long type is a 64-bit signed integer, but it can also be caused by other type mismatches.
Your best solution is to rewrite the Declare statement and match up the correct VB.NET data types to the ones specified in the C function header declaration.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there a Union type for VB.Net like the one in C and C++? I could really use one in my project but i dont see anything that resembles it. Any help would be aprciated
Pablo
|
|
|
|
|
No. The .NET Framework doesn't directly suport unions. This includes C# and any of the other Managed languages.
You can, however, simulate one by specifying a structure layout of Explicit and giving each of your fields the appropriate offset.
<StructLayout(LayoutKind.Explicit)> _
Private Structure UnionStructure
' First set of field values
<FieldOffset(0)> Public i As Integer
<FieldOffset(4)> Public j As Integer
' Second set of field values that overlay the first set
<FieldOffset(0)> Public k As Integer
<FieldOffset(4)> Public l As Integer
End Structure
Notice the FieldOffset 's for each field specifies exactly how far from the beginning of the structure each field should be placed. Field k overlays i and l overlays j .
You can find more information here[^] on MSDN.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks this will be helpfull
Pablo
|
|
|
|