|
I need help to convert a system variable to IP
the system variable is %clientname% and it will hold ex. P192168010004
if ya take away the P you have 192168010004 then I need a '.' every 3rd number like 192.168.010.004
Soo iam total noob with VB scripting and I would gladly take all help I can..
Thanks alot..
|
|
|
|
|
It would help if you were a little more specific about what your are having trouble with, but here's the whole solution anyway...
Dim WshShell, strEnvString, strIPAddress
Set WshShell = WScript.CreateObject("WScript.Shell")
strEnvString = WshShell.ExpandEnvironmentStrings("%ClientName%")
' Just ignore the first character, we can start parsing out the address anywhere we want.
strIPAddress = Mid(strEnvString, 2, 3) & "." & _
Mid(strEnvString, 5, 3) & "." & _
Mid(strEnvString, 8, 3) & "." & _
Mid(strEnvString, 11, 3)
WScript.Echo "The machine IP is " & strIPAddress
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please suggest a solution, wherein a client application in VB.NET needs to pick the db connection string from a remote server. I do not wish the client app to be supplied with the db connectivity details, but on successful login [using remote class] be supplied with the db connection string.
Thanks in advance
|
|
|
|
|
If your using a remote class, what's stopping you from passing back a string value with the connection string?
After a successful login, the client could just use Remoting to request the connection string from the server using the same method that was used to perform the authentication...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I need to modify some registry value with a vb.net application.
I can modify easyly string value but I can't modify DWORD value.
Any1 know how to change DWORD value ?
thx
Sybux
|
|
|
|
|
You might want to post the code your having problems with because writing a DWORD value is no different than writing an SZ value to the registry.
Dim testSettings As RegistryKey = Registry.CurrentUser.CreateSubKey("TestSettings")
testSettings.SetValue("Level", "Intermediate") ' String to SZ value
testSettings.SetValue("ID", 123) ' Integer to DWORD value
Using teh Win32.Registry methods, you have no control over what value type is written to the registry. It's just set by teh SetValue method based on the type of data that is passed into the 2nd parameter of the SetValue method.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
im encountering this error when i'm browsing my crystal reports...
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: <b>BC30389: 'C' is not accessible in this context because it is 'Private'.</b>
Source Error:
Line 12: <body MS_POSITIONING="GridLayout">
Line 13: <form id="Form1" method="post" runat="server">
Line 14: <CR:CrystalReportViewer id=CrystalReportViewer1 style="Z-INDEX: 101; LEFT: 192px; POSITION: absolute; TOP: 35px" runat="server" Width="1029px" Height="1090px" ReportSource="<%# C:\\inetpub\wwwroot\reports\top10.rpt %>">
Line 15: </CR:CrystalReportViewer>
Line 16: </form>
Source File: c:\inetpub\wwwroot\Reports\WebForm1.aspx Line: 14
|
|
|
|
|
try to change C:\\inetpub\wwwroot\reports\top10.rpt
in
'C:\inetpub\wwwroot\reports\top10.rpt'
beware of the ' !
|
|
|
|
|
tried doing that already but its not yet working... i think it has something to do with the OS..
|
|
|
|
|
I'll stake my like on it NOT being the OS. The problem is in your code.
You have something like this:
<CR:CrystalReportViewer id=CrystalReportViewer1 style="Z-INDEX: 101; LEFT: 192px; POSITION: absolute; TOP: 35px" runat="server" Width="1029px" Height="1090px" ReportSource="<%# C:\\inetpub\wwwroot\reports\top10.rpt %>">
The problem is that everything inside the <%# > is being interpreted as CODE and not a filename. Whatever code your using to put that filename in that place is where the problem is. the end result line should look like this:
><CR:CrystalReportViewer id=CrystalReportViewer1 style="Z-INDEX: 101; LEFT: 192px; POSITION: absolute; TOP: 35px" runat="server" Width="1029px" Height="1090px" ReportSource="C:\inetpub\wwwroot\reports\top10.rpt">
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i followed your advice but there was still an error..
Parser Error Message: Cannot create an object of type 'System.Object' from its string representation 'c:\inetpub\wwwroot\reports\top10.rpt' for the 'ReportSource' property.
hope you can help me again! thanks!
|
|
|
|
|
Like I said in my previous post ... Post the code. WIthout it, we can't see what's going on...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm taking a vb.net class. During one of the exercises demonstrated was how the keyboard responds to keypress,keydown, and keyup with a message box showing each action occuring. but the keyup never displayed the keyup message. can someone explain why the keyup did not display?
thanks
g
|
|
|
|
|
Messagebox.show runs modally and therefore will stop the keyup firing. If you use debug.writeline, or set the text of a label, you see the events firing, as in this code example below.
Create a form with a textbox (Textbox1) and three labels (Label1, Label2, Label3)
Add the following code
Private Sub TextBox1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Me.Label1.Text = "KeyDown Fired : " & e.KeyData.ToString
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Me.Label2.Text = "KeyPress Fired : " & e.KeyChar
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
Me.Label3.Text = "KeyUp Fired : " & e.KeyData.ToString
End Sub
|
|
|
|
|
Hi,
We are trying to develop an tool that renders rtf from XML.
All things work fine, the styled view is OK
The major problem is rendering of table
The table is rendered correctly but the text donot wrap in the cell it flows across the boundaries.
From the search on Microsoft sites we found that the RichEdit dll version 4.1 supports it. It uses MSFTEdit.dll to solve the problem
But I don't know why the RichTextBox Control in System.Windows.Forms namespace in .Net is not functioning corectly. It looks like the control still refers to old version of DLL
Can someone help me in solving this problem. As it has come to a stage where the project cannot proceed and may be canned if this doesn't work
More details
OS: Windows XP and Windows 2000
.Net Framework: 1.1
Visual Studio.Net Version: 2003
Looking for a solution!!
Regards,
Nasir
|
|
|
|
|
The .NET RichTextBox is just a wrapper around the RichEdit common control and XP as well as 2000 have "Rich Text Edit Control, v3.0" included in RichEd20.dll in WinNT\System32. So you'll only get what these DLLs can deliver.
Office XP installs version 4.0 of the Rich Text Edit Control in common files\Microsoft Shared\Office10, don't know about Office 2003...
I also had a version dependent problem with the RichTextBox (Undo/Redo buffer gets deleted when accessing the Text property) and could solve it by copying the more recent version of Riched20.dll into my program's executable path. But I assume this might not be an option for a commercial app
Regards,
Mav
|
|
|
|
|
I have an encrypted excel file that I need to read into a string so I can decrypted and write it back out. Everything has been working, except when running under mulit-byte languages such as: Japanese. I am almost sure that it has to do with the non-unicode flag set the the regional and language options under the advanced tab. Could someone point me in the right direction. Here is my sample code.
Dim fNum As Integer
Dim fileNameFrom As String
Dim fileNameTo As String
fileNameFrom = "C:\R00231090.xls"
fileNameTo = "C:\R00231090.mtp"
fNum = FreeFile()
FileOpen(fNum, fileNameFrom, OpenMode.Binary, OpenAccess.Read)
fileText = New String("", FileLen(fileNameFrom))
FileGet(fNum, fileText)
FileClose(fNum)
'fileText = "Call Decryption Method" Pretend that you called this.
fNum = FreeFile()
FileOpen(fNum, fileNameTo, OpenMode.Binary, OpenAccess.Write)
FilePut(fNum, fileText)
FileClose(fNum)
Make sure that the Language for non-Unicode programs is set to Japanese if it is not then it works find.
Thanks
Stephen
|
|
|
|
|
Hello everyone,
Once again, the newbie of programming has come to beseech your help. For my lovely Tic Tac Toe game that I am developing within VB.NET 2003 - I wanted to give my players Avatars (graphics that displays the players picture or character). I started with making a form to act as the Avatar Gallery.
What I want to be able to do is take the graphic that the player selects (using a radio button) and display it on my Game Form (frmGame). I had no idea how to do this, so, I started playing around. I made a Module and public'ed a PictureBox. I created a button that stated when clicked to take the picture of the forms PictureBox and transfer it to the Module- Public PictureBox.
At first it worked, and all was good - though after that, it stopped. I don't know what exactly I did to change things, though now simply figure I was doing it wrong in the first place. So, now I come before you to ask what a good method is for creating a picture gallery that you can select the picture to display on another form.
Any help is appreciated - articles, threads, and so forth. Thanks!
~Achithyn
|
|
|
|
|
Hmm, well, I am guessing this either cannot be done, no one knows how to do it, or, this thread was simply looked over. I have looked around some more though can't seem to be able to answer my question :S - If any of you know how to do this, please let me know. Thanks!
~Achithyn
|
|
|
|
|
Oi, sorry guys - I figured it out and it was a very simple problem. Thanks for the help on my other problems - I will make sure I don't ask stupid questions in the future.
~Achithyn
|
|
|
|
|
I'm having trouble populating a combo box with all the rows for a certain field in an Access database. Right now I can use a Currency Manager to cycle through all the individual records on my form, I just can't get all the rows for a given column to come up in the combo box. Here is an example of my problem. The only thing on the form here is cboComboBox:
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mcnConn As OleDbConnection
Dim mdsDSet As New DataSet
Dim mcmCurMang As CurrencyManager
Dim mvueDatVue As DataView
Dim mdaAdapter As OleDbDataAdapter
Dim strConnectionString As String
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DUBookstore2000.mdb"
mcnConn = New OleDbConnection(strConnectionString)
Dim strSQLStatement As String
strSQLStatement = "SELECT Name FROM Publishers"
mdaAdapter = New OleDbDataAdapter(strSQLStatement, mcnConn)
mdaAdapter.Fill(mdsDSet, "Publishers")
mvueDatVue = New DataView(mdsDSet.Tables("Publishers"))
Me.cboComboBox.DataBindings().Add("Text", mvueDatVue, "Name")
mcmCurMang = CType(Me.BindingContext(mvueDatVue), CurrencyManager)
End Sub
End Class
Of course this isn't my whole form, like I said it just gives an illustration of the problem I'm having. Thanks in advance for the help!
-Steve
|
|
|
|
|
Change it to this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mcnConn As OleDbConnection
Dim mdsDSet As New DataSet
Dim mcmCurMang As CurrencyManager
Dim mvueDatVue As DataView
Dim mdaAdapter As OleDbDataAdapter
Dim strConnectionString As String
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DUBookstore2000.mdb"
mcnConn = New OleDbConnection(strConnectionString)
Dim strSQLStatement As String
strSQLStatement = "SELECT Name FROM Publishers"
mdaAdapter = New OleDbDataAdapter(strSQLStatement, mcnConn)
mdaAdapter.Fill(mdsDSet, "Publishers")
mvueDatVue = New DataView(mdsDSet.Tables("Publishers"))
Me.cboComboBox.DataSource = mvueDatVue
Me.cboComboBox.ValueMember = "Name"
'mcmCurMang = CType(Me.BindingContext(mvueDatVue), CurrencyManager)
End Sub
progload
|
|
|
|
|
Thanks, that helped! Unfortunately though, now that has led me to another problem. The sub above is from an application that uses textboxes to display individual fields from an Access table. There is no grid on the form, each record is displayd via the textboxes along with one combobox (which displays a particular book's publisher). There are two buttons on the form to let the user go forward or backward through the individual records on the form. Pretty striaghtforward stuff.
The problem I'm running into now is that, since that combobox is populated, it is simply populated with a list of publishers that are displayed as one would move through the record set. Like this....here's what the combo box should display:
Company A
Company B
Company C
Company D
Okay. Let's say there are 24 records in the table in the Access database. Right now, that combo box is showing this:
Company A
Company D
Company D
Company C
Company A
Company B
.....
and so on, depending on what book is linked to what publisher, as we go through the records. So, how can I tweek that code above to show a non-repeating list of the publishers? Thanks in advance.
-Steve
|
|
|
|
|
Change your SQL statement to:
strSQLStatement = "SELECT DISTINCT Name FROM Publishers ORDER BY Name"
|
|
|
|
|
That didn't really change anything. Let me post a little more code:
This is my sub to bind the textboxes and that combobox.
Private Sub BindData()
'**********************************
'Purpose: Binding the labels, txtboxes, and
'comboboxes on the form to the data
'
'Outputs: Bound display controls to the data and the currency manager
'
'Author: Steve Swanson
'Date: July 26, 2004
'
'**********************************
Dim strSQLPublishers As String = "SELECT DISTINCT Name FROM Publishers"
Try
'create a list of publisher Name's based on PublisherID
mdaPublishers = New OleDbDataAdapter(strSQLPublishers, mcnDuBookstore2000)
mdaPublishers.Fill(mdsDuBookstore2000Books, "Publishers")
cboPublisher.DataSource = mvueDuBookstore2000
cboPublisher.ValueMember = "Name"
'bind the txtboxes on the form to the corresponding columns in the
'DUBookstore2000.mdb database
Me.lblBookID.DataBindings.Add("Text", mvueDuBookstore2000, "BookID")
Me.txtTitle.DataBindings.Add("Text", mvueDuBookstore2000, "Title")
Me.txtAuthorName.DataBindings.Add("Text", mvueDuBookstore2000, "AuthorName")
Me.cboPublisher.DataBindings.Add("Text", mvueDuBookstore2000, "Name")
Me.txtPrice.DataBindings.Add("Text", mvueDuBookstore2000, "Price")
Me.txtBooksOnHand.DataBindings.Add("Text", mvueDuBookstore2000, "BooksOnHand")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
'use the currency manager to control the iteration through the rows
'in the database
mcmDuBookStore2000Books = CType(Me.BindingContext(mvueDuBookstore2000), CurrencyManager)
End Sub
Hope this helps, I can post more if needed.
|
|
|
|
|