Compare 2 string equal false, open dialog

Hi all,
I developpe a function who compare if a certain link is in an list. This list can be full by the user with a File.openDialog.
My function work only with link who haven't any space in the file name. I think it'is a encoding problem but i don't know how to fix this problem.
If anyone can help me I would appreciate!
Thanks you!
My code look like this:
//choose a certain file
var array_of_files = File.openDialog ("selectionner une image ou plusieurs images", get_file_filter ([".psd", ".png", ".jpg", ".eps"], "choisir une image"), true);
// add to an array, i add the decode because my file as space and i want that to display it without %
myArray.push(File.decode(array_of_files[index].name));
After I select all links and I foreach link I compare if the link is in the array myArray
var array_all_links = doc_package.links;
for(var i = 0; i<array_all_links.length; i++){
      is_link_valid (array_all_links[i])
// this function doesn't work with link with space
function is_link_valid(link_item){
    var is_link_valid = true;
    if(is_in_array(link_item.name, results.array_of_ignored_picture) ){
        is_link_valid = false;
    alert(is_link_valid);
    return is_link_valid;
function is_in_array(myString, myArray) {
          for (x in myArray) {
                    if (myString == myArray[x]) {
                              return true;
          return false;

@Bastien – spaces (white space) in file names should be no problem at all…
Just the composites you encountered.
I did not test this:
I don't know if this will "normalize" composite characters in file names, but you could also write the list of file or path names to a text file with Unicode UTF-16 encoding and extract an array by reading it out, so you could compair with another array.
But I know that an UTF-16 encoding is required for the source txt or csv files for datamerge in InDesign if one is using eg. Umlauts in file names. Just discovered this and wrote about here:
Jim04:
Inserting an image from a CSV file
http://forums.adobe.com/message/5606395#5606395
I think, this wasn't one of the ways František Erben suggested.
One was something with hash tags and a text file, the other one was using a "Unicode Normalizer"…
But better ask for details  in the other thread:
František Erben:
Problem with UTF filenames on Mac OS X
http://forums.adobe.com/thread/1275272?tstart=0
Uwe

Similar Messages

  • How to compare two strings whether both are equal while ignoring the difference in special characters (example: & vs & and many others)?

    I attempted to compare two strings whether they are equal or not. They should return true if both are equal.
    One string is based on Taxonomy's Term (i.e. Term.Name) whereas other string is based on String object.
    The problem is that both strings which seem equal return false instead of true. Both string values have different special characters though their special characters are & and &
    Snapshot of different design & same symbols:
    Is it due to different culture or language?
    How to compare two strings whether both are equal while ignoring the difference in special characters (& vs &)?

    Hi Jerioon,
    If you have a list of possible ambiguous characters the job is going to be easy and if (& vs &) are the only charracters in concern awesome.
    You can use the below solution.
    Before comparing pass the variables through a replace function to standarize the char set.
    $Var = Replace($Var,"&","&")
    This is going to make sure you don't end up with ambiguous characters failing the comparison and all the char are "&" in this case.
    Similar technique is used to ignore Character Cases 'a' vs. 'A'
    Regards,
    Satyajit
    Please “Vote As Helpful”
    if you find my contribution useful or “Mark As Answer” if it does answer your question. That will encourage me - and others - to take time out to help you.

  • How to display image using from open dialog box?

    I've developed a program that can display image by named the file that I want to display in my program.
    But how can I display an image from an Open Dialog Box?
    I attch here with my program.
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.filechooser.*;
    public class SuDisplayTool6 extends JFrame implements InternalFrameListener,ActionListener
    JTextArea display1;
    JDesktopPane desktop;
    JInternalFrame displayWindow;
    JInternalFrame listenedToWindow;
    static final String SHOW = "Show Image";
    static final int desktopWidth = 800;
    static final int desktopHeight = 600;
    private static final int kControlX = 88 ;
    private DrawingPanel panel;
    public SuDisplayTool6(String title)
    super("Internal Frame");
    desktop = new JDesktopPane();
    desktop.putClientProperty("JDesktopPane.dragMode","outline");
    desktop.setPreferredSize(new Dimension(desktopWidth, desktopHeight));
    setContentPane(desktop);
    addMenu();
    createDisplayWindow();
    desktop.add(displayWindow);
    Dimension displaySize = displayWindow.getSize();
    displayWindow.setSize(desktopWidth, displaySize.height);
    protected void createDisplayWindow()
    JButton b1 = new JButton("Show Image");
    b1.setActionCommand(SHOW);
    b1.addActionListener(this);
    display1 = new JTextArea(3,30);
    display1.setEditable(false);
    JScrollPane textScroller = new JScrollPane(display1);
    textScroller.setPreferredSize(new Dimension(200,75));
    textScroller.setMinimumSize(new Dimension(10,10));
    displayWindow = new JInternalFrame("Header Graph",true,false,true,true);
    JPanel contentPane = new JPanel();
    contentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
    contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    contentPane.add(textScroller);
    b1.setAlignmentX(CENTER_ALIGNMENT);
    contentPane.add(b1);
    displayWindow.setContentPane(contentPane);
    displayWindow.pack();
    displayWindow.show();
    protected void createListenedToWindow()
    listenedToWindow = new JInternalFrame("Image",true,true,true,true);
    listenedToWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    listenedToWindow.setSize(800,450);
    panel = new DrawingPanel();
    listenedToWindow.setContentPane(panel);
    public void internalFrameClosing(InternalFrameEvent e)
    public void internalFrameClosed(InternalFrameEvent e)
    listenedToWindow = null;
    public void internalFrameOpened(InternalFrameEvent e)
    public void internalFrameIconified(InternalFrameEvent e)
    public void internalFrameDeiconified(InternalFrameEvent e)
    public void internalFrameActivated(InternalFrameEvent e)
    public void internalFrameDeactivated(InternalFrameEvent e)
    public void actionPerformed(ActionEvent e)
    if (e.getActionCommand().equals(SHOW))
    if (listenedToWindow == null)
    createListenedToWindow();
    listenedToWindow.addInternalFrameListener(this);
    desktop.add(listenedToWindow);
    listenedToWindow.setLocation(desktopWidth/2 - listenedToWindow.getWidth()/2,
    desktopHeight - listenedToWindow.getHeight());
    listenedToWindow.show();
    else
    public static void main(String[] args)
    JFrame frame = new SuDisplayTool6("Su Display Tool");
    frame.addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    frame.pack();
    frame.setVisible(true);
    private void addMenu()
    JMenuBar menuBar;
    JMenu menu, submenu;
    JMenuItem menuItem;
    final JFileChooser fc = new JFileChooser();
    fc.addChoosableFileFilter(new ImageFilter());
    menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    menu = new JMenu("File");
    menuBar.add(menu);
    menuItem = new JMenuItem("Open...");
    menu.add(menuItem).addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    int returnVal = fc.showOpenDialog(SuDisplayTool6.this);
    menuItem = new JMenuItem("Save");
    menu.add(menuItem);
    menuItem = new JMenuItem("Save As...");
    menu.add(menuItem).addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    int returnVal = fc.showSaveDialog(SuDisplayTool6.this);
    menuItem = new JMenuItem("Close");
    menu.add(menuItem);
    menu.addSeparator();
    menuItem = new JMenuItem("Exit");
    menu.add(menuItem).addActionListener(new WindowHandler());
    menu = new JMenu("Edit");
    menuBar.add(menu);
    menu = new JMenu("View");
    menuBar.add(menu);
    menuItem = new JMenuItem("Zoom In");
    menu.add(menuItem);
    menuItem = new JMenuItem("Zoom Out");
    menu.add(menuItem);
    menu.addSeparator();
    submenu = new JMenu("Header");
    menuItem = new JMenuItem("CDPX");
    submenu.add(menuItem);
    menuItem = new JMenuItem("SX");
    submenu.add(menuItem);
    menuItem = new JMenuItem("CX");
    submenu.add(menuItem);
    menu.add(submenu);
    menu = new JMenu("Help");
    menuBar.add(menu);
    menuItem = new JMenuItem("About");
    menu.add(menuItem).addActionListener(new WindowHandler());
    private class WindowHandler extends WindowAdapter implements ActionListener
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    if(e.getActionCommand().equalsIgnoreCase("exit"))
    System.exit(0);
    else if(e.getActionCommand().equalsIgnoreCase("About"))
    JOptionPane.showMessageDialog(null,"This program is written by Nenny Ruthfalydia.","About",JOptionPane.PLAIN_MESSAGE);
    class DrawingPanel extends Panel
    final ImageIcon imageIcon = new ImageIcon("image8.jpg");
    Image image = imageIcon.getImage();
    public void paint (Graphics g)
    g.drawImage(image, 10, 10, this);

    so much wrong with this post...
    a) use the code tags to format the code. Now it is an unreadable mess
    b) scriptlets in your JSP. I don't even want to look at that mess. Learn how to combine servlets and JSPs to create clean, readable and maintainable code in which view logic and business logic are separated. The rule: no java code in your JSP, only tags and EL expressions (learn about JSTL).
    So you get a blank screen. When you do "view source" in your browser, do you see anything there? If nothing, check if you are behind a proxy server. The solution to a post of not too long ago was that the blank screen was being caused by faulty proxy server settings (the user figured it out himself, I don't know what was done to solve it).
    If all this fails you will have to do some debugging magic using your favorite IDE. It will probably be something stupid you are overlooking in the code. It is annoying, but debugging code that does not work is a big part of your job. Better get good at it.

  • Internal error at open dialog box

    Hi All,
    I have created an add-on, there i have given the facility for attachments. When i click on browse button open dialog box opens.
        In some computers when i click on browse button, it gives internal error (-2147467259) occurred -unspecified Error.
    So can any one help on this?
    Regard's
    Hari

    ========
    Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
    Select Case pVal.ItemUID
    Case "Btnbrowse"
    Me.OpenFile()
    end select
    Private Sub *OpenFile*(ByRef BubbleEvent As Boolean)
    Try
    ShowFolderBrowserThread = New Threading.Thread(AddressOf ShowFolderBrowser)
    If ShowFolderBrowserThread.ThreadState = ThreadState.Unstarted Then ShowFolderBrowserThread.SetApartmentState(ApartmentState.STA)
    ShowFolderBrowserThread.Start()
    ElseIf ShowFolderBrowserThread.ThreadState = ThreadState.Stopped Then
    ShowFolderBrowserThread.Start()
    ShowFolderBrowserThread.Join()
    End If
    Catch ex As Exception
    sbo_application.MessageBox("OpenFile" & ex.Message)
    End Try
    Private Sub ShowFolderBrowser()
    Dim MyTest As New OpenFileDialog
    Dim MyProcs() As System.Diagnostics.Process
    Dim filename As String
    MyProcs = process.GetProcessesByName("SAP Business One")
    If MyProcs.Length = 1 Then
    For i As Integer = 0 To MyProcs.Length - 1
    '// WindowWraper concepts are used to access open dialogue box of windows
    Dim MyWindow As New WindowWrapper(MyProcs(i).MainWindowHandle)
    MyTest.Filter = "Excel files (*.xls)|*.xls|Document files (*.doc)|*.doc|Presentation (*.ppt)|*.ppt|Adobe PDF Files (*.pdf)|*.pdf|Text Documents (*.txt)|*.txt" '|All Files (*.)|.*"
    'MyTest.InitialDirectory = "C:\Program Files\SAP\SAP Business One\Attachments"
    '// Initial path for open dialogue box
    '// We can change as per the requirements
    MyTest.InitialDirectory = "C:\Program Files\SAP\SAP Business One\Attachments"
    If MyTest.ShowDialog(MyWindow) = DialogResult.OK Then
    filename = MyTest.FileName
    .your validations........
    Else
    System.Windows.Forms.Application.ExitThread()
    End If
    end sub
    Public Class WindowWrapper
    Implements System.Windows.Forms.IWin32Window
    Private _hwnd As IntPtr
    Public Sub New(ByVal handle As IntPtr)
    _hwnd = handle
    End Sub
    Public ReadOnly Property Handle() As System.IntPtr Implements System.Windows.Forms.IWin32Window.Handle
    Get
    Return _hwnd
    End Get
    End Property
    End Class
    To open the file you can use the follwing code on display button pressed.
    Private Sub *fileopen*(ByVal filename As String)
    '// Opening specified document with reference to the filename distributed
    Try
    System.Diagnostics.Process.Start(filename)
    Catch ex As Exception
    sbo_application.StatusBar.SetText("File Not Found in Specified Path:" & filename, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
    End Try
    End Sub
    ========
    Public Sub SBO_ManageItemEvent( _
      ByVal FormUID As String, _
      ByRef pVal As SAPbouiCOM.ItemEvent, _
      ByRef BubbleEvent As Boolean _
    ) ' Item Event Handler
      Dim oForm As SAPbouiCOM.Form
      oForm = SBO_Application.Forms.Item(FormUID)
      Select Case pVal.EventType
          Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED
           Select Case pVal.ItemUID
               Case "btnBrowse"       ' Select file
                If Not pVal.BeforeAction Then
                    Call ShowFolderBrowser(oForm)
                End If
           End Select
      End Select
      oForm = Nothing
    End Sub
    Private Sub ShowFolderBrowser(ByRef oForm As SAPbouiCOM.Form)
      Try
          ' ++++++++++++++++++++++++++++++++++++++++++++++++++
          ' I'm using default path...
          ' ++++++++++++++++++++++++++++++++++++++++++++++++++
          Dim sPath As String = SBO_Company.ExcelDocsPath
          oForm.Freeze(True)
          SBO_Application.Desktop.State = BoFormStateEnum.fs_Minimized
          ' ++++++++++++++++++++++++++++++++++++++++++++++++++
          ' All windows down with command ^M
          ' ++++++++++++++++++++++++++++++++++++++++++++++++++
          Const KEYEVENTF_KEYUP = &H2
          Const VK_LWIN = &H5B
          Call keybd_event(VK_LWIN, 0, 0, 0)
          Call keybd_event(77, 0, 0, 0)
          Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
          Dim fileName As String = ""
          Dim OpenFileDialog As New OpenFileDialog
          OpenFileDialog.Title = "Select Excel File"
          OpenFileDialog.Filter = "Excel files (*.xls)|*.xls"
          If Not sPath.Equals("") Then
           OpenFileDialog.InitialDirectory = sPath
          Else
           OpenFileDialog.InitialDirectory = Me.SBO_FormEventHDL.BdgPathLog  '"C:\"
          End If
          If OpenFileDialog.ShowDialog() = DialogResult.OK Then
           fileName = OpenFileDialog.FileName
           sFileXls = fileName
           ' ++++++++++++++++++++++++++++++++++++++++++++++++++
           ' Here I post getted path into my edittext field
           ' ++++++++++++++++++++++++++++++++++++++++++++++++++
           Dim oEdit As SAPbouiCOM.EditText
           Dim oItem As SAPbouiCOM.Item
           oItem = oForm.Items.Item("eFileName")
           oEdit = oItem.Specific
           oEdit.Value = sFileXls
           oItem = Nothing
           oEdit = Nothing
          End If
      Catch ex As Exception
        ' log exception
      Finally
          oForm.Freeze(False)
          SBO_Application.Desktop.State = BoFormStateEnum.fs_Restore
          System.GC.Collect() 'Release the handle to the table
      End Try
    End Sub

  • Compare two strings in an array

    Hello!
    Please feel free to give me hints, but do not give me any code.
    Ok, here is what I am trying to do, I whant to compare my input string whith strings allready stored in the array. If my input string equals any of the allready excisting strings, a error wil show upp, otherwise store the new string in next avalibal position. I do not seem to get the method right for comparing the strings. here is the method I have written so far, please take a look and give me a hint, but no code. :)
    //Check if a user already excists     
    public void compareNames (People in_array [], String in_name) {
              for (int i=0; i<value.peopleCount; i++) {
                   if (in_name.equals(in_array.getPeople())) {
                   System.out.print("The user already excist, please chose another name");
    }value.peopleCount is an global count value for people arays.
    getPeople get the name from the people class.
    Martin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    A couple notes here.
    The name compareNames() is misleading if it is going to do what you described. A comparison will generally not have side-effects like outputting error messages to the console or adding new items to an array. It would be better if you called the method addIfNew(), and returned a boolean indicating whether the name was new or not. The caller would then be responsible for displaying an error message if the method returned false.
    I also suggest you use a List such as ArrayList instead of an array, otherwise you will have to resize and copy your array every time you add something to it that exceeds the array size, and will allow you to do away with the global peopleCount.

  • On String Equality (using ==)

    Hello. I am trying to create a program that will merge sentences on their first similar word occurence, i.e.:
    Given "good day. i would like to see you at the office"
    and "how are you feeling today?"
    It will produce "good day. i would like to see you feeling today".
    If there are no similar words, the program will just concatenate the Strings.
    I tested the examples above and I got "good day. i would like to see you at the office how are you feeling today". Obviously, something's wrong.
    So I fiddled around my code putting printlns here and there. Then I found out that my comparison loops doesn't stop. Equality ( == ) always evaluates to false.
    On my tester class, I tried the following:
    String intro = "good day. i would like to see you at the office";
    String outtro = "how are you feeling today?";
    String[] fooArray = intro.split(" ");
    String[] barArray = intro.split(" ");
    String foo = fooArray[7];
    String bar = barArray[2];
    System.out.println("Is foo equal to bar? " + foo == bar);The abovementioned code returned false.
    Then I tried the following
    String intro = "good day. i would like to see you at the office";
    String outtro = "how are you feeling today?";
    String[] fooArray = intro.split(" ");
    String[] barArray = intro.split(" ");
    String foo = fooArray[7];
    String bar = barArray[2];
    System.out.println("How about chars? " + foo.charAt(0) == bar.charAt(0));This time around, it returned true.
    So I'm guessing that maybe I should just create a function that will loop through the chars of the String and compare them.
    However, I am bothered by how Java handled foo == bar . Can someone explain to me why this happened? Is there a workaround to this one or should I always create a function that loops through chars everytime I want to compare Strings?
    Thanks!

    == compares references for equality. When you want to compare two Object instances for equality you use the equals method. This applies not only to String but any other type of Object..

  • Comparing Japanese Strings

    I am using String .equals method to compare two japanese strings, but it is returning false even though the strings are equal, but it returns true if the strings are english.
    Do i have to do something special to compare japanese strings?

    Sorry, i am using UTF-8 encoding, i tried ISO-8859-1 but it didnt worked.
    I am using
    BufferedReader rdr =
             new BufferedReader(
                 new InputStreamReader(new FileInputStream("abc.csv"),"UTF-8"));
    String line=rdr.readLine();
    String tempArray[] = line.split(",");
    System.out.println(xlsobj.Headers.containsKey(tempArray[0]);Headers is a HashMap which contains the japanese string which i want to compare.
    I tried to use equals() method in my effort to debug but it is also returning false.

  • Comparing indented strings

    Hello,
    I am reading HTML source files, line by line, and I am having troubles when it comes to comparing strings.
    The problem is the indentation of the HTML source; it is preventing me from comparing strings.
    Is there anyway to work around this?
    import java.net.*;
    import java.io.*;
    public class HtmlCompare
         public static void main(String[] args)
              try
                            //Open up URL
                   URLConnection connect = new URL(args[0]).openConnection();
                   connect.setDoOutput(false);
                   connect.setDoInput(true);
                   connect.connect();
                            //Display connection status
                   int i = 1;
                   String headerFieldKey;
                   while ((headerFieldKey = connect.getHeaderFieldKey(i)) != null)
                        System.out.println(headerFieldKey+": "+connect.getHeaderField(i));
                        i++;
                   if (i > 1)
                        System.out.println();
                            //Read website's HTML source
                            BufferedReader siteBuffer = new BufferedReader(new InputStreamReader(connect.getInputStream()));
                            BufferedReader templateBuffer = new BufferedReader(new FileReader("template.txt"));
                            String bufferString;
                            String templateString;
                            int count=0;
                            boolean writeBool = false;
                   try
                                    //create output file
                                    BufferedWriter out = new BufferedWriter(new FileWriter("mine3.txt",true));
                                    String newline = System.getProperty("line.separator");
                                    while ((bufferString = siteBuffer.readLine()) != null)
                                            //compare until end of templateFile
                                            if ((templateString = templateBuffer.readLine()) != null)
                                                    if (bufferString.indexOf(templateString) != -1)
                                                            writeBool = true;
                                                            count=1;
                                            //write to output file
                                            if (writeBool) out.write(bufferString + newline);
                                            //terminate writing from loop
                                            if ((templateString = templateBuffer.readLine()) == null) writeBool = false;
                                    out.close();
                            } catch (IOException e)
                                    System.out.println("Cannot write to file");
              } catch (Throwable t)
                   t.printStackTrace();
    }Thanks in advance!

    I figured it out;
    If you are searching for something, say "/m at the start of an img src="/m tag, use this code:
    if(bufferString.indexOf(('\"'+"/m")) != -1)
              String[] temp = bufferString.split(('\"'+"/m"));
              temp[1] = "www.site.com/m" + temp[1];
              temp[0] = temp[0] + temp[1];
              bufferString = temp[0];                                                               
    }

  • String equal?

    I have some instrument which communicate with PC via RS232. So I use VISA write, read...
    It's working OK, but have next problem
    I want to compare two strings, one is constant other one will come out from VISA read. If I use indicator, it's show "hex"(for example 3E04 4B73 ) value from VISA, but if I use same wire to "equal?" to compare two strings it's return strange values...
    Let's see all together to see what's my problem:
    Rookie; LV 2011 on WIN 7
    Solved!
    Go to Solution.

    I don't know the definition of "strange values", especially for a boolean that can only be false or true. Can you explain?
    What is the display format of the diagram constant? (normal or hex?)
    Once you have the right valuue in the indicator, you can right-click the terminal and "create constant". Now you have a diagram constant that is guaranteed to be identical to the current value of the indicator.
    LabVIEW Champion . Do more with less code and in less time .

  • String equality

    Hi,
    I've recently had a problem with string equality. My problem is the following:
    element.getName() == String2
    (getName() method returns a string)
    returns false, but both strings really seem to be equal, that is:
    System.out.println(String1 +"/"+ String2 +"=" + (String1 == String2));
    prints
    LAMES/LAMES=false
    which seems pretty strange to me.
    I searched both is the javadocs and in the tutorial, but I did not find any solution to my problem. How that 2 strings containing the same Characters are not equal.
    Nicolas

    This has been stated NUMEROUS times throughout the forums...
    == compares Objects (two String Objects will most likely NOT be equal, even if both contain the same characters in the same sequence)
    String.equals(...) compares the equality of the contents of the Strings

  • File Open Dialog Box Hiding Behind - Urgent

    Hi All
    We have write code for Opening File in File Open Dialog Box. But its stays in inactive mode behind SBO. Once we press ALT +TAB only then we can see it. How to Activate it or make it visible automatically in SAP Business One.
    The Code for Opening File we have written is in C#
    <b>OpenFileDialog objOpenFileDialog = new OpenFileDialog();
    objOpenFileDialog.InitialDirectory = System.Windows.Forms.Application.StartupPath + "
                        objOpenFileDialog.Filter = "Excel files (.xls)|.xls";
                        if(objOpenFileDialog.ShowDialog()!= DialogResult.Cancel)
    string ExcelFilePath = objOpenFileDialog.FileName;
    }</b>
    Thanks in Advance
    Asutosh

    Common problem... Do the following instead.
    System.Windows.Forms.Form form = new System.Windows.Forms.Form();
    form.TopMost = true;
    OpenFileDialog objOpenFileDialog = new OpenFileDialog();
    objOpenFileDialog.InitialDirectory = System.Windows.Forms.Application.StartupPath + "\";
    objOpenFileDialog.Filter = "Excel files (*.xls)|*.xls";
    if(objOpenFileDialog.ShowDialog(form)!= DialogResult.Cancel)
    string ExcelFilePath = objOpenFileDialog.FileName;
    That should do it

  • How to Compare two strings in PL/SQL

    Hi All,
    I need to compare two strings whether they are equal or not in PL/SQL.Is there any function to comparing the strings.

    Yes, the = sign.
    Are you after something like:
    IF v_string1 = v_string2 THEN
    ELSE
    END IF;?
    Edited by: Boneist on 27-Aug-2009 11:41

  • Calling Windows File Open Dialog from Forms

    Has anyone used the File Open Dialog of MS-Windows from within
    forms? How do you invoke it and how do you pass arguements (in
    and out) to communicate with it?

    GET_FILE_NAME built-in
    Description
    Displays the standard open file dialog box where the user can
    select an existing file or specify a new file.
    Syntax
    FUNCTION GET_FILE_NAME
    (directory_name VARCHAR2,
    file_name VARCHAR2,
    file_filter VARCHAR2,
    message VARCHAR2,
    dialog_type NUMBER,
    select_file BOOLEAN;
    Built-in Type unrestricted function
    Returns VARCHAR2
    Enter Query Mode yes
    Parameters
    directory_name     
    Specifies the name of the directory containing the file you want
    to open. The default value is NULL. If directory_name is NULL,
    subsequent invocations of the dialog may open the last directory
    visited.
    file_name     
    Specifies the name of the file you want to open. The default
    value is NULL.
    file_filter     
    Specifies that only particular files be shown. The default
    value is NULL. File filters take on different forms, and
    currently are ignored on the motif and character mode
    platforms. On Windows, they take the form of Write Files
    (*.WRI)|*.WRI| defaulting to All Files (*.*)|*.*| if NULL.
    On the Macintosh the attribute currently accepts a string such
    as Text.
    message     
    Specifies the type of file that is being selected. The default
    value is NULL.
    dialog_type     
    Specifies the intended dialog to OPEN_FILE or SAVE_FILE. The
    default value is OPEN_FILE.
    select_file     
    Specifies whether the user is selecting files or directories.
    The default value is TRUE. If dialog_type is set to SAVE_FILE,
    select_file is internally set to TRUE.
    ** Built-in: GET_FILE_NAME
    ** Example: Can get an image of type TIFF.
    DECLARE
    filename VARCHAR2(256)
    BEGIN
    filename := GET_FILE_NAME(File_Filter=> 'TIFF Files (*.tif)
    |*.tif|');
    READ_IMAGE_FILE(filename, 'TIFF', 'block5.imagefld);
    END;

  • How to set default file type for Open dialog

    Dear my friends,
    I am using "At selection-screen ON VALUE-REQUEST FOR filepath" to display open dialog and i want to set default file type for open dialog = *.txt.
    Thank your times !

    Hello,
    U can make use of this code:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR SP_FILE.
      PERFORM SAVE_DIALOG CHANGING SP_FILE G_F_RC.
    FORM SAVE_DIALOG CHANGING PO_FILE PO_RC.
      DATA: L_VA_BOXTITLE     TYPE STRING,
            L_VA_DEFAULTFILE  TYPE STRING,
            L_VA_DEFAULTNAME  TYPE STRING,
            L_VA_DEFAULTPATH  TYPE STRING,
            L_VA_DEFAULTFULL  TYPE STRING,
            L_VA_FILTERTEXT   TYPE STRING,
            L_VA_CODE         TYPE I.
      CLEAR: PO_RC, G_F_CONF.
      L_VA_BOXTITLE   = TEXT-B01.
      L_VA_FILTERTEXT = TEXT-B02.
      IF PO_FILE IS INITIAL.
        CLEAR L_VA_DEFAULTFILE.
      ELSE.
        L_VA_DEFAULTFILE = PO_FILE.
      ENDIF.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          WINDOW_TITLE            = L_VA_BOXTITLE
          DEFAULT_EXTENSION       = 'TXT'
          DEFAULT_FILE_NAME       = L_VA_DEFAULTFILE
          FILE_FILTER             = L_VA_FILTERTEXT
          INITIAL_DIRECTORY       = 'C:SAPWorkdir'
        CHANGING
          FILENAME                = L_VA_DEFAULTNAME
          PATH                    = L_VA_DEFAULTPATH
          FULLPATH                = L_VA_DEFAULTFULL
          USER_ACTION             = L_VA_CODE
        EXCEPTIONS
          CNTL_ERROR              = 1
          ERROR_NO_GUI            = 2
          OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        PERFORM CHECK_ERRORTYPE(Z48M_MATDATA_UP) CHANGING SY-MSGTY.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        CLEAR PO_FILE.
        EXIT.
      ENDIF.
      IF L_VA_CODE NE 0.
        MESSAGE S818(3F) WITH TEXT-011.
        CLEAR: PO_FILE, PO_RC.
        EXIT.
      ELSE.
        WRITE L_VA_DEFAULTFULL TO PO_FILE.
        G_F_CONF = G_C_XFELD.
      ENDIF.
    ENDFORM.                    " save_dialog
    If useful reward.
    Vasanth

  • How to Use Open Dialog Box, & Save Dialog Box

    Hi Frens,
    Can You tell me how can i use open dialog box, and save
    dialog box using Flex. Because there is no such components are
    given here.
    Also How can i Do when I click on some button, or some event
    Please tell me abt this, Thks in advance frens
    Ashish Mishra

    for input requested try this
    String ar = JOptionPane.showInputDialog("Please, enter artist name");for any sort of message box try this
    int answer = JOptionPane.showConfirmDialog(null, "Enter another record?",
                                "???",JOptionPane.YES_NO_OPTION);This might help you buddy.

Maybe you are looking for

  • Ovi Sync Problem

    Hey guys ,                 Whenever i`m trying to sync my N8 with the OVI application the error comes every time .... I don't no why this is happening ????? I tried so many time but it failed to do that.... I`ve attached the picture which is showing

  • Connection to a new PC

    I updated my ipod using my old PC and I don't know how to transfer all my itunes from my ipod to the new library on my new pc. can anybody help?

  • FI Validation problem: exit works, but no message is displayed

    Hi guys, I hope you can help me, through SDN forum I was not able to find something good to resolve my problem. I've created a FI validation from GGB0 for F-36 and FB02 transaction, callpoint is complete document, to check some requisites on customer

  • No Sound On My Ipod Touch

    I put in my headphones and NO SOUND at all...not on videos not on music not even on itunes samples...the only sound that comes out of my ipod touch are the alarms! thats it! i tired restarting it...i might restore it...i dont know

  • BPM -eMail notification

    Hi, I am facing a strange issue, after server restarts getting bulk BPM eMail notifications for all pending and in-progress notifications..where to control this. Also I couldn't able to see Cancel Delegate Revoke buttons after task opened, I did conf