Search Results

Search found 251 results on 11 pages for 'msgbox'.

Page 8/11 | < Previous Page | 4 5 6 7 8 9 10 11  | Next Page >

  • How to create (via installer script) a task that will install my bash script so it runs on DE startup?

    - by MountainX
    I've been reading for the last couple hours about Upstart, .xinitrc, .xsessions, rc.local, /etc/init.d/, /etc/xdg/autostart, @reboot in crontab and so many other things that I'm totally confused! Here is my bash script. It should start/run after the desktop environment is started and it should continue to run at all times until logout/shutdown. It should start again on reboot. Any time the DE is running, it should run. #!/bin/bash while true; do if [[ -s ~/.updateNotification.txt ]]; then read MSG < ~/.updateNotification.txt kdialog --title 'The software has been updated' --msgbox "$MSG" cat /dev/null > ~/.updateNotification.txt fi sleep 3600 done exit 0 I know zero about using Upstart, but I understand that Upstart is one way to handle this. I'll consider other approaches but most of the things I've been reading about are too complex for me. Furthermore, I can't figure out which approach will meet my requirements (which I'll detail below). There are two steps in my question: How to automatically start the script above, as described above. How to "install" that Upstart task via a bash script (i.e., my "installer"). I assume (or hope) that step 2 is almost trivial once I understand step 1. I have to support all flavors of Ubuntu desktops. Therefore, the kdialog call above will be replaced. I'm considering easybashgui for this. (Or I could use zenity on gnome DE's.) My requirements are: The setup process (installation) must be done via a bash script. I cannot use the GUI method described in the Ubuntu doc AddingProgramToSessionStartup, for example. I must be able to script/automate the setup (installing) process using bash. Currently, it is as simple as having the bash installer script copy the above script into /home/$USER/.kde/Autostart/ The setup process must be universal across Ubuntu derivatives including Unity and KDE and gnome desktops. The same setup script (installer) should run on Linux Mint, Kubuntu, Xbuntu (basically any flavor of Ubuntu and major derivatives such as Linux Mint). For example, we cannot continue to put a script file in /home/$USER/.kde/Autostart/ because that exists only on KDE. The above script should work for each of the limited flavors we use. Hence our interest in using easybashgui instead of kdialog or zenity. See below. The installed monitoring script should only be started after the desktop is started since it will display a GUI message to the user if the update is found. The monitoring script (above) should run without root privileges, of course. But the installer (bash script) can be run as root. I'm not a real developer or a sysadmin. This is a part time volunteer thing for me, so it needs to be easy/simple. I can write bash scripts and I can program a little, but I know nothing about Upstart or systemd, for example. And, unfortunately, my job doesn't give me time to become an expert on init systems or much of anything else related to development and sysadmin. So I have to stick with simple solutions. The easybashgui version of the script might look like this: #!/bin/bash source easybashgui while true; do if [[ -s ~/.updateNotification.txt ]]; then read MSG < ~/.updateNotification.txt message "$MSG" cat /dev/null > ~/.updateNotification.txt fi sleep 3600 done exit 0

    Read the article

  • Sending formatted Lotus Notes rich text email from Excel VBA

    - by Lunatik
    I have little Lotus Script or Notes/Domino knowledge but I have a procedure, copied from somewhere a long time ago, that allows me to email through Notes from VBA. I normally only use this for internal notifications where the formatting hasn't really mattered. I now want to use this to send external emails to a client, and corporate types would rather the email complied with our style guide (a sans-serif typeface basically). I was about to tell them that the code only works with plain text, but then I noticed that the routine does reference some sort of CREATERICHTEXTITEM object. Does this mean I could apply some sort of formatting to the body text string after it has been passed to the mail routine? As well as upholding our precious brand values, this would be quite handy to me for highlighting certain passages in the email. I've had a dig about the 'net to see if this code could be adapted, but being unfamiliar with Notes' object model, and the fact that online Notes resources seem to mirror the application's own obtuseness, meant I didn't get very far. The code: Sub sendEmail(EmailSubject As String, EMailSendTo As String, EMailBody As String, MailServer as String) Dim objNotesSession As Object Dim objNotesMailFile As Object Dim objNotesDocument As Object Dim objNotesField As Object Dim sendmail As Boolean 'added for integration into reporting tool Dim dbString As String dbString = "mail\" & Application.UserName & ".nsf" On Error GoTo SendMailError 'Establish Connection to Notes Set objNotesSession = CreateObject("Notes.NotesSession") On Error Resume Next 'Establish Connection to Mail File Set objNotesMailFile = objNotesSession.GETDATABASE(MailServer, dbString) 'Open Mail objNotesMailFile.OPENMAIL On Error GoTo 0 'Create New Memo Set objNotesDocument = objNotesMailFile.createdocument Dim oWorkSpace As Object, oUIdoc As Object Set oWorkSpace = CreateObject("Notes.NotesUIWorkspace") Set oUIdoc = oWorkSpace.CurrentDocument 'Create 'Subject Field' Set objNotesField = objNotesDocument.APPENDITEMVALUE("Subject", EmailSubject) 'Create 'Send To' Field Set objNotesField = objNotesDocument.APPENDITEMVALUE("SendTo", EMailSendTo) 'Create 'Copy To' Field Set objNotesField = objNotesDocument.APPENDITEMVALUE("CopyTo", EMailCCTo) 'Create 'Blind Copy To' Field Set objNotesField = objNotesDocument.APPENDITEMVALUE("BlindCopyTo", EMailBCCTo) 'Create 'Body' of memo Set objNotesField = objNotesDocument.CREATERICHTEXTITEM("Body") With objNotesField .APPENDTEXT emailBody .ADDNEWLINE 1 End With 'Send the e-mail Call objNotesDocument.Save(True, False, False) objNotesDocument.SaveMessageOnSend = True 'objNotesDocument.Save objNotesDocument.Send (0) 'Release storage Set objNotesSession = Nothing Set objNotesMailFile = Nothing Set objNotesDocument = Nothing Set objNotesField = Nothing 'Set return code sendmail = True Exit Sub SendMailError: Dim Msg Msg = "Error # " & Str(Err.Number) & " was generated by " _ & Err.Source & Chr(13) & Err.Description MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext sendmail = False End Sub

    Read the article

  • Passing an array argument from Excel VBA to a WCF service

    - by PrgTrdr
    I'm trying to pass an array as an argument to my WCF service. To test this using Damian's sample code, I modified GetData it to try to pass an array of ints instead of a single int as an argument: using System; using System.ServiceModel; namespace WcfService1 { [ServiceContract] public interface IService1 { [OperationContract] string GetData(int[] value); [OperationContract] object[] GetSomeObjects(); } } using System; namespace WcfService1 { public class Service1 : IService1 { public string GetData(int[] value) { return string.Format("You entered: {0}", value[0]); } public object[] GetSomeObjects() { return new object[] { "String", 123, 44.55, DateTime.Now }; } } } Excel VBA code: Dim addr As String addr = "service:mexAddress=""net.tcp://localhost:7891/Test/WcfService1/Service1/Mex""," addr = addr + "address=""net.tcp://localhost:7891/Test/WcfService1/Service1/""," addr = addr + "contract=""IService1"", contractNamespace=""http://tempuri.org/""," addr = addr + "binding=""NetTcpBinding_IService1"", bindingNamespace=""http://tempuri.org/""" Dim service1 As Object Set service1 = GetObject(addr) Dim Sectors( 0 to 2 ) as Integer Sectors(0) = 10 MsgBox service1.GetData(Sectors) This code works fine with the WCF Test Client, but when I try to use it from Excel, I have this problem. When Excel gets to the service1.GetData call, it reports the following error: Run-time error '-2147467261 (80004003)' Automation error Invalid Pointer It looks like there is some incompatibility between the interface specification and the VBA call. Have you ever tried to pass an array from VBA into WCF? Am I doing something wrong or is this not supported using the Service moniker?

    Read the article

  • StackOverflow in VB.NET SQLite query

    - by Majgel
    I have an StackOverflowException in one of my DB functions that I don't know how to deal with. I have a SQLite database with one table "tblEmployees" that holds records for each employees (several thousand posts) and usually this function runs without any problem. But sometimes after the the function is called a thousand times it breaks with an StackOverflowException at the line "ReturnTable.Load(reader)" with the message: An unhandled exception of type 'System.StackOverflowException' occurred in System.Data.SQLite.dll If I restart the application it has no problem to continue with the exact same post it last crashed on. I can also make the exactly same DB-call from SQLite Admin at the crash time without no problems. Here is the code: Public Function GetNextEmployeeInQueue() As String Dim NextEmployeeInQueue As String = Nothing Dim query As [String] = "SELECT FirstName FROM tblEmployees WHERE Checked=0 LIMIT 1;" Try Dim ReturnTable As New DataTable() Dim mycommand As New SQLiteCommand(cnn) mycommand.CommandText = query Dim reader As SQLiteDataReader = mycommand.ExecuteReader() ReturnTable.Load(reader) reader.Close() If ReturnTable.Rows.Count > 0 Then NextEmployeeInQueue = ReturnTable.Rows(0)("FirstName").ToString() Else MsgBox("No more employees found in queue") End If Catch fail As Exception MessageBox.Show("Error: " & fail.Message.ToString()) End Try If NextEmployeeInQueue IsNot Nothing Then Return NextEmployeeInQueue Else Return "No more records in queue" End If End Function When crashes, the reader has "Property evaluation failed." in all values. I assume there is some problem with allocated memory that isn't released correctly, but can't figure out what object it's all about. The DB-connection opens when the DB-class object is created and closes on main form Dispose. Should I maybe dispose the mycommand object every time in a finally block? But wouldn't that result in a closed DB-connection?

    Read the article

  • Easy to use AutoHotkey/AutoIT alternatives for Linux

    - by Xeddy
    Hi all, I'm looking for recommendations for an easy-to-use GUI automation/macro platform for Linux. If you're familiar with AutoHotkey or AutoIT on Windows, then you know exactly the kind of features I need, with the level of complexity. If you aren't familiar, then here's a small code snippet of how easy it is to use AHK: InputBox, varInput, Please enter some random text... Run, notepad.exe WinWaitActive, Untitled - Notepad SendInput, %varInput% SendInput, !f{Up}{Enter}{Enter} WinWaitActive, Save SendInput, SomeRandomFile{Enter} MsgBox, Your text`, %varInput% has been saved using notepad! #n::Run, notepad.exe Now the above example, although a bit pointless, is a demo of the sort of functionality and simplicity I'm looking for. Here's an explanation for those who don't speak AHK: ----Start of Explanation of Code ---- Asks user to input some text and stores it in varInput Runs notepad.exe Waits till window exists and is active Sends the contents of varInput as a series of keystrokes Sends keystrokes to go to File - Exit Waits till the "Save" window is active Sends some more keystrokes Shows a Message Box with some text and the contents of a variable Registers a hotkey, Win+N, which when pressed executes notepad.exe ----End of Explanation---- So as you can understand, the features are quite obvious: Ability to easily simulate keyboard and mouse functions, read input, process and display output, execute programs, manipulate windows, register hotkeys, etc.. all being done without requiring any #includes, unnecessary brackets, class declarations etc. In short: Simple. Now I've played around a bit with Perl and Python, but its definitely no AHK. They're great for more advanced stuff, but surely, there has to be some tool out there for easy GUI automation? PS: I've already tried running AHK with Wine but sending keystrokes and hotkeys don't work.

    Read the article

  • Crystal report error message

    - by Selom
    Hi, ive been dealing with a kind of no error message my application is throwing after the setup has been installed on my machine. The application run fine and generate a report exactly the way i want it. The problem is that after compiling it as set up, it throw this message: System.Runtime.InteropServices.COMException (0x80000000); No error. at CrystalDesisionsReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault) at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet) at Presby_Soft.reportFrm.reportFrm_Load(Object sender, EventArgs e) this is the code im using: Private Sub reportFrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If conn.State = ConnectionState.Closed Then conn.Open() End If Try Dim rpt As New CrystalReport1() Dim da As New SQLiteDataAdapter Dim ds As New presbydbDataSet 'Dim cmd As New SQLiteCommand("SELECT personal_details.fn, training.training_level FROM personal_details INNER JOIN training ON personal_details.Staff_ID ='" + detailsFrm.Label13.Text + "'", conn) Dim cmd As New SQLiteCommand("SELECT * FROM personal_details WHERE personal_details.staff_ID='" + detailsFrm.Label13.Text + "'", conn) cmd.ExecuteNonQuery() da.SelectCommand = cmd da.Fill(ds, "personal_details") rpt.Subreports.Item("persoRpt").SetDataSource(ds) CrystalReportViewer1.ReportSource = rpt Catch ex As Exception MsgBox(ex.ToString) End Try conn.Close() End Sub Please help, I really don't know how to go about this problem. Thanks for answering

    Read the article

  • Change the Default Application Pool in IIS7 using .net?

    - by EdenMachine
    I'm using the following function to create a IIS7 Application and/or Virtual Directory. How would I also set the Application to use a different Application Pool? Private Sub CreateVirtualDir(ByVal WebSite As String, ByVal AppName As String, ByVal Path As String, Optional ByVal IsApplication As Boolean = True, Optional ByVal RunScripts As Boolean = True, Optional ByVal IsWrite As Boolean = True) Dim IISSchema As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/Schema/AppIsolated") Dim CanCreate As Boolean = Not IISSchema.Properties("Syntax").Value.ToString.ToUpper() = "BOOLEAN" IISSchema.Dispose() If CanCreate Then Dim PathCreated As Boolean Try Dim IISAdmin As New System.DirectoryServices.DirectoryEntry("IIS://" & WebSite & "/W3SVC/1/Root") 'make sure folder exists If Not System.IO.Directory.Exists(Path) Then System.IO.Directory.CreateDirectory(Path) PathCreated = True End If 'If the virtual directory already exists then delete it For Each VD As System.DirectoryServices.DirectoryEntry In IISAdmin.Children If VD.Name = AppName Then IISAdmin.Invoke("Delete", New String() {VD.SchemaClassName, AppName}) IISAdmin.CommitChanges() Exit For End If Next VD 'Create and setup new virtual directory Dim VDir As System.DirectoryServices.DirectoryEntry = IISAdmin.Children.Add(AppName, "IIsWebVirtualDir") VDir.Properties("Path").Item(0) = Path If IsApplication Then VDir.Properties("AppFriendlyName").Item(0) = AppName End If VDir.Properties("EnableDirBrowsing").Item(0) = False VDir.Properties("AccessRead").Item(0) = True VDir.Properties("AccessExecute").Item(0) = False VDir.Properties("AccessWrite").Item(0) = IsWrite VDir.Properties("AccessScript").Item(0) = RunScripts VDir.Properties("AuthNTLM").Item(0) = True VDir.Properties("EnableDefaultDoc").Item(0) = True VDir.Properties("DefaultDoc").Item(0) = "default.htm,default.aspx,default.asp" VDir.Properties("AspEnableParentPaths").Item(0) = True 'VDir.Properties("AppCreate").Item(0) = False VDir.CommitChanges() 'the following are acceptable params 'INPROC = 0 'OUTPROC = 1 'POOLED = 2 If IsApplication Then VDir.Invoke("AppCreate", 1) Else VDir.Invoke("AppCreate", False) End If Catch Ex As Exception If PathCreated Then System.IO.Directory.Delete(Path) End If 'MsgBox(Ex.Message) End Try End If End Sub

    Read the article

  • How to solve "catastrophic failure" with 32-bit COM component in SysWOW64\cscript or wscript

    - by kcrumley
    I'm trying to run a VBScript script that uses a 7-year-old 3rd-party 32-bit COM component on Windows Server 2008 R2, with the command-line 32-bit script host, SysWOW64\cscript.exe. When I call CreateObject on the class, it appears to be successful, but the very first time I try to use a property or method (I've tried several different ones) on the object, it gives me the "catastrophic failure". I have identical results with SysWOW64\wscript.exe, except, of course, that my error message comes in a msgbox instead of the command-line window. I think this has to do specifically with the 64-bit scripting hosts because of the following: The equivalent Classic ASP script, calling the same component and using 95% of the same code, works correctly on the same server, with IIS configured to support 32-bit COM. The same VBScript works correctly on a 32-bit Windows XP machine and a 32-bit Windows Server 2003 machine. The component fails in exactly the same way on my 64-bit Windows 7 machine. My Google searches for solutions to this problem have mostly turned up a lot of different problems that were solved by putting the COM component into a toolbar in Visual Studio. Obviously, that solution doesn't apply here. My questions are: Is there a core problem that is always behind a "catastrophic failure" from a Windows scripting host calling a COM component? Is there a place in a configuration snap-in, or in the registry, where I need to make a change similar to the change I had to make to the IIS Application pool to "Enable 32-bit Applications"? Is there a general place in the Server 2008 R2 Event Viewer that I should be looking, to see if there are any more details on the failure, in case it turns out to be specific to this component? Thanks in advance.

    Read the article

  • .NET COM Interop on Windows 7 64Bit gives me a headache

    - by Kevin Stumpf
    Hey guys, .NET COM interop so far always has been working quite nicely. Since I upgraded to Windows 7 I don't get my .NET COM objects to work anymore. My COM object is as easy as: namespace Crap { [ComVisible(true)] [Guid("2134685b-6e22-49ef-a046-74e187ed0d21")] [ClassInterface(ClassInterfaceType.None)] public class MyClass : IMyClass { public MyClass() {} public void Test() { MessageBox.Show("Finally got in here."); } } } namespace Crap { [Guid("1234685b-6e22-49ef-a046-74e187ed0d21")] public interface IMyClass { } } assembly is marked ComVisible as well. I register the assembly using regasm /codebase /tlb "path" registers successfully (admin mode). I tried regasm 32 and 64bit. Both time I get the error "ActiveX component cant create object Crap.MyClass" using this vbscript: dim objReg Set objReg = CreateObject("Crap.MyClass") MsgBox typename(objReg) fuslogvw doesn't give me any hints either. That COM object works perfectly on my Vista 32 Bit machine. I don't understand why I haven't been able to google a solution for that problem.. am I really the only person that ever got into that problem? Looking at OleView I see my object is registered successfully. I am able to create other COM objects as well.. it only does not work with my own ones. Thank you, Kevin

    Read the article

  • Problem creating simple "windows script components" on Windows 7.

    - by Bigtoe
    Hi folks, I'm trying to get a Windows Script Component working on and x64 development machine. Works fine on x32 bit. But can't seem to get it running, I have the same problem with both JScript and VBScript. Here's the most simple wsc component possible. All that it does it pop up "Hello" in a message box. If you save the snippit below to a file called test_lib.wsc, you'll then be able to right click and register it. It's now available as a COM Component. <?xml version="1.0"?> <component> <?component error="true" debug="true"?> <registration description="Test Script Library" progid="TestScript.Lib" version="1.00" classid="{314042ea-1c42-4865-956f-08d56d1f00a8}" > </registration> <public> <method name="Hello"> </method> </public> <script language="VBScript"> <![CDATA[ Option Explicit Function Hello() MsgBox("Hello.") End Function ]]> </script> </component> Next create the following sample vb-script and save it to a file called test.vbs dim o set o = createobject("TestScript.Lib") o.hello() When I run the test.vbs with cscript or wscript I always get the following. "C:\test.vbs(3, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'TestScript.Lib'" This works perfectly fine on a 32 bit XP. Anyone got any ideas about what could be wrong? Thanks a bunch Noel.

    Read the article

  • Capture keystrokes (e.g., function keys) while a messagebox is up

    - by FastAl
    We have a large WinForms app, and there is a built-in bug reporting system that can be activated during testing via the F5 Key. I am capturing the F5 key with .Net's PreFilterMessage system. This works fine on the main forms, modal dialog boxes, etc. Unfortunately, the program also displays windows messageboxes when it needs to. When there is a bug with that, e.g., wrong text in the messagebox or it shouldn't be there, the messagefilter isn't executed at all when the messagebox is up! I realize I could fix it by either rewriting my own messagebox routine, or kicking off a separate thread that polls GetAsyncKeyState and calls the error reporter from there. However I was hoping for a method that was less of a hack. Here's code that manifests the problem: Public Class Form1 Implements IMessageFilter Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click MsgBox("now, a messagebox is up!") End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Application.AddMessageFilter(Me) End Sub Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) _ As Boolean Implements IMessageFilter.PreFilterMessage Const VK_F5 As Int32 = &H74 Const WM_KEYDOWN As Integer = &H100 If m.Msg = WM_KEYDOWN And m.WParam.ToInt32 = VK_F5 Then ' In reality code here takes a screenshot, saves the program state, and shows a bug report interface ' IO.File.AppendAllText("c:\bugs.txt", InputBox("Describe the bug:")) End If End Function End Class Many thanks.

    Read the article

  • Texture loading at joGL

    - by Nour
    hi I've been trying to load a bmp picture to use it as a texture at my program I've used a IOstream Class to extend DataInputStream to read the pixels at the photo with this code "based on a texture loader code for c++ " : //class Data members public static int BMPtextures[]; public static int BMPtexCount = 30; public static int currentTextureID = 0; //loading methode static int loadBMPTexture(int index, String fileName, GL gl) { try { IOStream wdis = new IOStream(fileName); wdis.skipBytes(18); int width = wdis.readIntW(); int height = wdis.readIntW(); wdis.skipBytes(28); byte buf[] = new byte[wdis.available()]; wdis.read(buf); wdis.close(); gl.glBindTexture(GL.GL_TEXTURE_2D, BMPtextures[index]); gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, 3, width, height, 0, GL.GL_BGR, GL.GL_UNSIGNED_BYTE, buf); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); currentTextureID = index; return currentTextureID; } catch (IOException ex) { // Utils.msgBox("File Error\n" + fileName, "Error", Utils.MSG_WARN); return -1; } } and IOStream code : public class IOStream extends DataInputStream { public IOStream(String file) throws FileNotFoundException { super(new FileInputStream(file)); } public short readShortW() throws IOException { return (short)(readUnsignedByte() + readUnsignedByte() * 256); } public int readIntW() throws IOException { return readShortW() + readShortW() * 256 * 256; } void read(Buffer[] buf) { } } and the calling: GTexture.loadBMPTexture(1,"/BasicJOGL/src/basicjogl/data/Font.bmp",gl); after debugging I figured out that when it come to this line : IOStream wdis = new IOStream(fileName); an IOExeption occurred and it's a dispatchException .. what this impose to mean ?? and how can I solve it ? by the way i tried to : 1- use \ and \ and / and // 2- change the path of the photo and take all the path from c:\ to the photoname.bmp 3- rename the photo using numbers like 1.bmp but nothing seems to work :(

    Read the article

  • batch_add_field_VBA

    - by Elaine Kuo
    I am unsure where goes wrong. Please kindly help and thanks. Public Sub AddField() Dim pApp As esriCatalogUI.IGxApplication Set pApp = esriArcCatalog.Application Dim pGxSelection As esriCatalog.IGxSelection Set pGxSelection = pApp.Selection Dim plist As esriCatalog.IEnumGxObject Set plist = pGxSelection.SelectedObjects Dim pGxObject As esriCatalog.IGxObject Dim pName As esriSystem.IName Dim pDS As esriGeoDatabase.IDataset Dim pGDSE As esriGeoDatabase.IGeoDatasetSchemaEdit Dim pStatusBar As esriSystem.IStatusBar Set pStatusBar = esriArcCatalog.Application.StatusBar Dim pFeatLyr As esriCarto.IFeatureLayer Dim pFeatureClass As esriGeoDatabase.IFeatureClass Dim pFeatureDataset As esriGeoDatabase.IFeatureDataset Dim pFieldEdit As esriGeoDatabase.IFieldEdit Set pGxObject = plist.Next Set pFeatureClass = pGxObject If pFeatureClass.Type = esriDTFeatureClass Then Set pFeatLyr = New FeatureLayer Set pFeatLyr.FeatureClass = pFeatureDataset.Dataset pFeatLyr.name = pGXDataset.Dataset.name End If 'Checks to make sure you have something selected If pGxObject Is Nothing Then MsgBox "You need to select the files", vbOKOnly, "Error" Exit Sub End If 'Runs a function to add field Dim pField1 As esriGeoDatabase.IFieldEdit ' Define the first new field. Set pField1 = New Field pField1.Name = "GID1" pField1.Type = esriFieldTypeInteger pField1.Length = 10 pFeatureClass.AddField pField1 'Loops through all selected files and preforms Do Until pGxObject Is Nothing If TypeOf pGxObject Is esriCatalog.IGxDataset Then Set pName = pGxObject.InternalObjectName Set pDS = pName.Open Set pGDSE = pDS With pGDSE If .CanAlterSpatialReference Then .AlterSpatialReference pFieldEdit End If End With End If pStatusBar.Message(0) = "Done: " & pGxObject.Name Set pGxObject = plist.Next Loop CleanUp: Set pFieldEdit = Nothing Set pGDSE = Nothing pStatusBar.Message(0) = "Done" End Sub

    Read the article

  • Automation Error upon running VBA script in Excel

    - by brohjoe
    Hi guys, I'm getting an Automation error upon running VBA code in Excel 2007. I'm attempting to connect to a remote SQL Server DB and load data to from Excel to SQL Server. The error I get is, "Run-time error '-2147217843(80040e4d)': Automation error". I checked out the MSDN site and it suggested that this may be due to a bug associated with the sqloledb provider and one way to mitigate this is to use ODBC. Well I changed the connection string to reflect ODBC provider and associated parameters and I'm still getting the same error. Here is the code with ODBC as the provider: Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Dim stSQL As String Dim wbBook As Workbook Dim wsSheet As Worksheet Dim rnStart As Range Public Sub loadData() 'This was set up using Microsoft ActiveX Data Components version 6.0. 'Create ADODB connection object, open connection and construct the connection string object. Set cnt = New ADODB.Connection cnt.ConnectionString = _ "Driver={SQL Server}; Server=onlineSQLServer2010.foo.com; Database=fooDB Uid=logonalready;Pwd='helpmeOB1';" cnt.Open On Error GoTo ErrorHandler 'Open Excel and run query to export data to SQL Server. strSQL = "SELECT * INTO SalesOrders FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0', & _ "'Data Source=C:\Database.xlsx; Extended Properties=Excel 12.0')...[SalesOrders$]" cnt.Execute (strSQL) 'Error handling. ErrorExit: 'Reclaim memory from the connection objects Set rst = Nothing Set cnt = Nothing Exit Sub ErrorHandler: MsgBox Err.Description, vbCritical Resume ErrorExit 'clean up and reclaim memory resources. cnt.Close If CBool(cnt.State And adStateOpen) Then Set rst = Nothing Set cnt = Nothing End If End Sub

    Read the article

  • Updating Database from DataSet

    - by clawson
    I am having trouble updating my Database from my code using a DataSet. I'm using SQL Server 2008 and Visual Studio 2008. Here is what I've done so far. I have created a table in SQL Server called MyTable which has two columns: id nchar(10), and name nchar(50). I have then created a datasource in my VB.net project that consists of this table using the dataset wizard and called this dataset MyDataSet. I run the following code on a button click: Try Dim myDataSet As New MyDataSet Dim newRow As MyDataSet.MyTableRow = myDataSet.MyTable.NewMyTableRow newRow.id = "1" newRow.name = "Alpha" myDataSet.MyTable.AddMyTableRow(newRow) myDataSet.AcceptChanges() Catch ex As Exception MsgBox(ex.Message) End Try when I run this and check the rows in SQL Server it returns 0 rows What have I missed? How can I add these rows / save changes in a dataset to the database? I have seen other examples that use a TableAdapter but I don't think I want to do this, I think I should be able to achieve this just using a DataSet. Am I mistaken? Help is greatly appreciated!

    Read the article

  • excel:mysql: rs.Update crashes

    - by every_answer_gets_a_point
    i am connecting to mysql from excel and updating a table. as soon as i get to .update (rs.update) excel crashes. am i doing something wrong? Option Explicit Dim oConn As ADODB.Connection Private Sub ConnectDB() Set oConn = New ADODB.Connection oConn.Open "DRIVER={MySQL ODBC 5.1 Driver};" & _ "SERVER=localhost;" & _ "DATABASE=employees;" & _ "USER=root;" & _ "PASSWORD=pas;" & _ "Option=3" End Sub Function esc(txt As String) esc = Trim(Replace(txt, "'", "\'")) End Function Private Sub InsertData() Dim dpath, atime, rtime, lcalib, aname, rname, bstate, instrument As String Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset ConnectDB With wsBooks rs.Open "batchinfo", oConn, adOpenKeyset, adLockOptimistic, adCmdTable Worksheets.Item("Report 1").Select dpath = Trim(Range("B2").Text) atime = Trim(Range("B3").Text) rtime = Trim(Range("B4").Text) lcalib = Trim(Range("B5").Text) aname = Trim(Range("B6").Text) rname = Trim(Range("B7").Text) bstate = Trim(Range("B8").Text) ' instrument = GetInstrFromXML(wbBook.FullName) With rs .AddNew ' create a new record ' add values to each field in the record .Fields("datapath") = dpath .Fields("analysistime") = atime .Fields("reporttime") = rtime .Fields("lastcalib") = lcalib .Fields("analystname") = aname .Fields("reportname") = rname .Fields("batchstate") = bstate ' .Fields("instrument") = "NA" .Update ' stores the new record End With ' get the last id Set rs = oConn.Execute("SELECT @@identity", , adCmdText) 'MsgBox capture_id rs.Close Set rs = Nothing End With End Sub

    Read the article

  • RegAsm for Class Library Used in VB6 Application

    - by michael.lukatchik
    To be short and to the point, I've built a C# class library that is both COM-Visible and Registered for COM Interop. I've compiled the library, which resulted in the generation of .dll and .tlb files. I have another machine that's running a VB6 application. So, I copied the .dll and .tlb files over to C:/Windows/system32 folder on the machine. I then registered those files using the following: C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\Windows\system32\TestClass.dll /tlb:TestClass.tlb After the files were registered successfully, I added a project reference to the Test.tlb file from inside my VB6 app, then I tried to invoke a method in my new referenced class like so: Dim myObject As TestNamespace.TestClass Set myObject = New TestNamespace.TestClass MsgBox (myObject.TestMethod()) It doesn't work, and I receive a -2147024894 Automation Error. I've read that I shouldn't install the dll into a private folder like system32. I should either be registering in the GAC or I should be registering in another location using the "/codebase" option: C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\TestClass.dll /tlb:TestClass.tlb /codebase Is there any reason I shouldn't be using system32? Past devs that have worked on this project have placed assembly files used by this VB6 project into system32 and there haven't seemed to be any issues. When I register my dll in the system32 location, I get the Automation Error. When I register my dll in another location (i.e. C:/), the method call into my class library from VB6 works as expected. What gives? I should mention that we will NOT be using the GAC to register any DLL's. That's just the way it is. Any help is appreciated. Mike

    Read the article

  • How to return a recordset from a function

    - by Scott
    I'm building a data access layer in Excel VBA and having trouble returning a recordset. The Execute() function in my class is definitely retrieving a row from the database, but doesn't seem to be returning anything. The following function is contained in a class called DataAccessLayer. The class contains functions Connect and Disconnect which handle opening and closing the connection. Public Function Execute(ByVal sqlQuery as String) As ADODB.recordset Set recordset = New ADODB.recordset Dim recordsAffected As Long ' Make sure we are connected to the database. If Connect Then Set command = New ADODB.command With command .ActiveConnection = connection .CommandText = sqlQuery .CommandType = adCmdText End With ' These seem to be equivalent. 'Set recordset = command.Execute(recordsAffected) recordset.Open command.Execute(recordsAffected) Set Execute = recordset recordset.ActiveConnection = Nothing recordset.Close Set command = Nothing Call Disconnect End If Set recordset = Nothing End Function Here's a public function that I'm using in cell A1 of my spreadsheet for testing. Public Function Scott_Test() Dim Database As New DataAccessLayer 'Dim rs As ADODB.recordset 'Set rs = CreateObject("ADODB.Recordset") Set rs = New ADODB.recordset Set rs = Database.Execute("SELECT item_desc_1 FROM imitmidx_sql WHERE item_no = '11001'") 'rs.Open Database.Execute("SELECT item_desc_1 FROM imitmidx_sql WHERE item_no = '11001'") 'rs.Open ' This never displays. MsgBox rs.EOF If Not rs.EOF Then ' This is displaying #VALUE! in cell A1. Scott_Test = rs!item_desc_1 End If rs.ActiveConnection = Nothing Set rs = Nothing End Function What am I doing wrong?

    Read the article

  • Process Close does not close a process when performed in a SetTimer label

    - by NbdNnm
    The script below creates a child process to perform FileExist() separately from the main script so that it avoids halting the script when an unknown network path is passed. However, the command, Process close, does not close the given process despite its ErrorLevel indicates it succeeded to close. Task Manager shows the child process still exists. FileExistTimeout() ; this checks if the necessary parameters are passed ; this checks if the given path exists by creating a child process with the given timeout PathToCheck := "\\1.2.3.4\test" msgbox, 64, Test Result, % FileExistTimeout(PathToCheck) "`n" ErrorLevel FileExistTimeout(strPath="", nTimeout=1000, strSwitch="/fe") { global strParam1 = %1% strParam2 = %2% ; if the function is used to check the script parameters if (strPath="") { if (strParam2 = strSwitch) && strParam1 ; this means the function is placed at the beginning of the script. ExitApp % (FileExist(strParam1) != "") + 1 ; Return 1 or 2. Return } ; create a child process to check the path tooltip, RunWait is performing.... SetTimer, FileExistTimeout, % -1 * nTimeout RunWait "%A_AhkPath%" "%A_ScriptFullPath%" "%strPath%" "%strSwitch%",,, nPID SetTimer, FileExistTimeout, Off ; Disable the timer (if it hasn't fired already). tooltip ; ErrorLevel contains the exit code of the process (from RunWait). if ErrorLevel = 2 ; found return true else if ErrorLevel = 1 ; not found return return ; timeout FileExistTimeout: Process Close, %nPID% ; Timed out - terminate the process. tooltip, % "Process Closed: " ErrorLevel "`n" "Used Pid: " nPID,,, 2 return }

    Read the article

  • Automation Error when exporting Excel data to SQL Server

    - by brohjoe
    I'm getting an Automation error upon running VBA code in Excel 2007. I'm attempting to connect to a remote SQL Server DB and load data to from Excel to SQL Server. The error I get is, "Run-time error '-2147217843(80040e4d)': Automation error". I checked out the MSDN site and it suggested that this may be due to a bug associated with the sqloledb provider and one way to mitigate this is to use ODBC. Well I changed the connection string to reflect ODBC provider and associated parameters and I'm still getting the same error. Here is the code with ODBC as the provider: Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Dim stSQL As String Dim wbBook As Workbook Dim wsSheet As Worksheet Dim rnStart As Range Public Sub loadData() 'This was set up using Microsoft ActiveX Data Components version 6.0. 'Create ADODB connection object, open connection and construct the connection string object. Set cnt = New ADODB.Connection cnt.ConnectionString = "Driver={SQL Server}; Server=onlineSQLServer2010.foo.com; Database=fooDB;Uid=logonalready;Pwd='helpmeOB1';" cnt.Open On Error GoTo ErrorHandler 'Open Excel and run query to export data to SQL Server. strSQL = "SELECT * INTO SalesOrders FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0'," & _ "'Data Source=C:\Database.xlsx; Extended Properties=Excel 12.0')...[SalesOrders$]" cnt.Execute (strSQL) 'Error handling. ErrorExit: 'Reclaim memory from the connection objects Set rst = Nothing Set cnt = Nothing Exit Sub ErrorHandler: MsgBox Err.Description, vbCritical Resume ErrorExit 'clean up and reclaim memory resources. If CBool(cnt.State And adStateOpen) Then Set rst = Nothing Set cnt = Nothing cnt.Close End If End Sub

    Read the article

  • Providing File permissions in Installshield

    - by Pawan Kumar
    I have created an installer in Installshield X. I want to give 'write permissions' to few files when the installation is done in Non-Admin Windows accounts ( by default it will have only 'read' permission). If I select individual file and go to properties (inside Installshield),i have permissions tab where they have provided options like Domain , Readonly, Full Control, Modify etc. I have tested these options but it doesn't effect the msi file.(specific files doesn't have write permission). Is there something wrong I am doing? There is another way of doing this, writing the script Set objShell=CreateObject("WScript.Shell") installDir = Session.Property("INSTALLDIR.5A884667_3CC4_41EC_B0F2_BEEAB457BB8C") supportDir = Session.Property("SUPPORTDIR") length = Len(installDir) lastChar = Right(installDir, 1) if (lastChar = "\") Then installDir = Left(installDir, length - 1) end if 'MsgBox supportDir & "\setacl.exe """ & installDir & """ /dir /set S-1-5-32-545 /full /p:yes /sid /silent" objshell.Run supportDir & "\setacl.exe """ & installDir & """ /dir /set S-1-5-32-545 /full /p:yes /sid /silent",0,true Can someone please explain me what is going on here? those last set s-1-5-32-545. Thanks

    Read the article

  • having trouble disabling textbox in vb.net

    - by user225269
    How do I disable a textbox the second time? here is my code, In form load the textbox is disabled, unless the user will input an idnumber that is in the database. But what if the user will input an idnumber that is in the database then, input again another that is not, That is where this code comes in, but it has problems, it doesnt disable the textbox in the event of a mouse click, what would be the proper way of doing this? Private Sub Button12_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button12.MouseClick Dim NoAcc As String Dim NoAccmod2 As String Dim NoPas As String Dim sqlcon As New MySqlConnection("Server=localhost; Database=school;Uid=root;Pwd=nitoryolai123$%^;") Dim sqlcom As MySqlCommand = New MySqlCommand("Select * from student where IDNO= '" & TextBox14.Text & "' ", sqlcon) sqlcon.Open() Dim rdr As MySqlDataReader rdr = sqlcom.ExecuteReader If rdr.HasRows Then rdr.Read() NoAcc = rdr("IDNO") If (TextBox14.Text <> NoAcc) Then MsgBox("ID Number is not yet registered!, please register first in the general information before trying to register parents information", MsgBoxStyle.Information) TextBox7.Enabled = False TextBox8.Enabled = False TextBox9.Enabled = False TextBox10.Enabled = False TextBox11.Enabled = False TextBox12.Enabled = False TextBox13.Enabled = False End If End If

    Read the article

  • Differences in ansychronous VB.NET and C#???

    - by Jim Beam
    So I've been posting this week for help with an API that has asynchronous calls. You can view the CODE here: http://stackoverflow.com/questions/2638920/c-asynchronous-event-procedure-does-not-fire With a little more digging, I found out that the API is written in VB.NET and I created a VB.NET example and guess what . . . the asynchronous calls work like a charm. So, now I need to find out why the calls are not firing in the C# code I have. The API being written in VB really shouldn't matter, but again, the VB.NET code works and my C# does not. Is there a problem with the event handler and hows its being declared that causes it to not fire? UPDATE VB Code added Imports ClientSocketServices Imports DHS_Commands Imports DHS Imports Utility Imports SocketServices Class Window1 Public WithEvents AppServer As New ClientAppServer Public Token As LoginToken Private Sub login() Dim handler As New LoginHandler Token = handler.RequestLogin("admin", "admin", localPort:=12000, serverAddress:="127.0.0.1", serverLoginPort:=11000, clienttype:=LoginToken.eClientType.Client_Admin, timeoutInSeconds:=20) If Token.Authenticated Then AppServer = New ClientAppServer(Token, True) AppServer.RetrieveCollection(GetType(Gateways)) End If End Sub Private Sub ReceiveMessage(ByVal rr As RemoteRequest) Handles AppServer.ReceiveRequest If TypeOf (rr.TransferObject) Is Gateways Then MsgBox("dd") End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click login() End Sub End Class

    Read the article

  • Looping through recordset with VBA

    - by Robert
    I am trying to assign salespeople (rsSalespeople) to customers (rsCustomers) in a round-robin fashion in the following manner: Navigate to first Customer, assign the first SalesPerson to the Customer. Move to Next Customer. If rsSalesPersons is not at EOF, move to Next SalesPerson; if rsSalesPersons is at EOF, MoveFirst to loop back to the first SalesPerson. Assign this (current) SalesPerson to the (current) Customer. Repeat step 2 until rsCustomers is at EOF (EOF = True, i.e. End-Of-Recordset). It's been awhile since I dealt with VBA, so I'm a bit rusty, but here is what I have come up with, so far: Private Sub Command31_Click() 'On Error GoTo ErrHandler Dim intCustomer As Integer Dim intSalesperson As Integer Dim rsCustomers As DAO.Recordset Dim rsSalespeople As DAO.Recordset Dim strSQL As String strSQL = "SELECT CustomerID, SalespersonID FROM Customers WHERE SalespersonID Is Null" Set rsCustomers = CurrentDb.OpenRecordset(strSQL) strSQL = "SELECT SalespersonID FROM Salespeople" Set rsSalespeople = CurrentDb.OpenRecordset(strSQL) rsCustomers.MoveFirst rsSalespeople.MoveFirst Do While Not rsCustomers.EOF intCustomers = rsCustomers!CustomerID intSalesperson = rsSalespeople!SalespersonID strSQL = "UPDATE Customers SET SalespersonID = " & intSalesperson & " WHERE CustomerID = " & intCustomer DoCmd.RunSQL (strSQL) rsCustomers.MoveNext If Not rsSalespeople.EOF Then rsSalespeople.MoveNext Else rsSalespeople.MoveFirst End If Loop ExitHandler: Set rsCustomers = Nothing Set rsSalespeople = Nothing Exit Sub ErrHandler: MsgBox (Err.Description) Resume ExitHandler End Sub My tables are defined like so: Customers --CustomerID --Name --SalespersonID Salespeople --SalespersonID --Name With ten customers and 5 salespeople, my intended result would like like: CustomerID--Name--SalespersonID 1---A---1 2---B---2 3---C---3 4---D---4 5---E---5 6---F---1 7---G---2 8---H---3 9---I---4 10---J---5 The above code works for the intitial loop through the Salespeople recordset, but errors out when the end of the recordset is found. Regardless of the EOF, it appears it still tries to execute the rsSalespeople.MoveFirst command. Am I not checking for the rsSalespeople.EOF properly? Any ideas to get this code to work?

    Read the article

  • Access 2007 file picker, replaces all rows with the same choice.

    - by SqlStruggle
    This code is from an Access 2007 project I've been struggling with. The actual mean part is the part where I should put something like "update only current form" DoCmd.RunSQL "Update Korut Set [PikkuKuva]=('" & varFile & "') ;" Could someone please help me with this?` If I use it now, it updates all the tables with the same file picked. Heres the whole code. ' This requires a reference to the Microsoft Office 11.0 Object Library. Dim fDialog As Office.FileDialog Dim varFile As Variant Dim filePath As String ' Set up the File dialog box. Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog ' Allow the user to make multiple selections in the dialog box. .AllowMultiSelect = False ' Set the title of the dialog box. .Title = "Valitse Tiedosto" ' Clear out the current filters, and then add your own. .Filters.Clear .Filters.Add "All Files", "*.*" ' user picked at least one file. If the .Show method returns ' False, the user clicked Cancel. If .Show = True Then ' Loop through each file that is selected and then add it to the list box. For Each varFile In .SelectedItems DoCmd.SetWarnings True DoCmd.RunSQL "Update Korut Set [PikkuKuva]=('" & varFile & "') ;" Next Else MsgBox "You clicked Cancel in the file dialog box." End If End With

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11  | Next Page >