Select the name of the column in combobox

Hi !!
i have already get the name of the columns in a combobox with this code 
xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
xlWorkSheet.Activate()
xlApp.Visible = True
With xlWorkSheet
Dim LastCol As Integer = xlWorkSheet.Cells(1, xlWorkSheet.Columns.Count).End(XlDirection.xlToLeft).Column
For x As Integer = 1 To LastCol
ComboBox2.Items.Add(xlWorkSheet.Cells(1, x).value)
Next
End With
and what i want is :
when i select the name of the column :
-this column will be copie in a new sheet of the same workbook (a new sheet add and the column of the table will be there )
help me pleasee

i use tis code 
 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim Excols As New Dictionary(Of Integer, String)
        xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
        xlWorkSheet.Activate()
        xlApp.Visible = True
        With xlWorkSheet
            Dim LastCol As Integer = xlWorkSheet.Cells(1, xlWorkSheet.Columns.Count).End(XlDirection.xlToLeft).Column
            For x As Integer = 2 To LastCol
                Excols.Add(x, xlWorkSheet.Cells(1, x).value.ToString)
            Next
            ComboBox2.DataSource = New BindingSource(Excols, Nothing)
            ComboBox2.ValueMember = "Key"
            ComboBox2.DisplayMember = "Value"
            AddHandler ComboBox2.SelectedIndexChanged, AddressOf ComboBox2_SelectedIndexChanged
        End With
    End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        Dim exWS2 As Microsoft.Office.Interop.Excel.Worksheet
        xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
        xlWorkSheet.Activate()
        xlApp.Visible = True
        With xlWorkSheet
            Dim key As String = DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Key
            Dim value As String = DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Value
            Dim lastrow As Integer = xlWorkSheet.Cells.Rows.End(XlDirection.xlDown).Row
            Dim colletter As String = ColumnIndexToColumnLetter(key)
            exWS2 = DirectCast(xlWorkBook.Sheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
            exWS2.Name = value
           xlWorkSheet.Range(colletter & "1:" & colletter & lastrow.ToString).Copy(exWS2.Range("A1"))
            ' xlWorkSheet = DirectCast(xlWorkBook.ActiveSheet, Microsoft.Office.Interop.Excel.Worksheet)
            'exWS2 = DirectCast(xlWorkBook.Sheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
            'exWS2.Cells(1, 1).value = ComboBox2.SelectedItem.ToString
            'exWS2.Name = ComboBox2.SelectedItem.ToString
        End With
        Me.Hide()
        form2.show()
    End Sub
    Private Function ColumnIndexToColumnLetter(ByVal colIndex As Integer) As String
        Dim div As Integer = colIndex
        Dim colLetter As String = String.Empty
        Dim modnum As Integer = 0
        While div > 0
            modnum = (div - 1) Mod 26
            colLetter = Chr(65 + modnum) & colLetter
            div = CInt((div - modnum) \ 26)
        End While
        Return colLetter
    End Functionbut 
when i click on the button a new sheet add named the first colum and an other sheet add also empty 
without  choosing an items of the combobox :(
and  i get an error in this :   exWS2.Name = value
which is :
Impossible de renommer une feuille comme une autre feuille, une bibliothèque d'objets référencée ou un classeur
référencé par Visual Basic.

Similar Messages

  • Select the name of the column from sheet Excel

    Hi everyone,
    i use vb.net with excel 
    First, i have a button "browse"
    which open a workbook.
    Second ,i  have a button "get
    the names of the sheets" which give me the name of the sheet in a combobox ,then i choose the sheet.
    Then i have an other button " get
    the column names " which give me the name of the columns of the table in a combobox .
    When i select the name of the column a new sheet add named the
    name of the column and which has the data of this column
    what i want is :
     when i select again the same column a messagebox will
    be shown "you have already select it "
    And when i go back to choose another sheet then another column
    will be open without getting any error
    this is the code of the combobox :
    Public Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
    xlWorkSheet.Activate()
    xlApp.Visible = True
    With xlWorkSheet
    Dim key As String = CStr(DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Key)
    Dim value As String = DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Value
    Dim lastrow As Integer = xlWorkSheet.Cells.Rows.End(XlDirection.xlDown).Row
    Dim colletter As String = ColumnIndexToColumnLetter(CInt(key))
    exWS2 = DirectCast(xlWorkBook.Sheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
    exWS2.Name = value
    xlWorkSheet.Range("A1:A" & lastrow.ToString).Copy(exWS2.Range("A1"))
    End With
    End Sub
    and if you want to know the code of the button here is :
    Public Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim Excols As New Dictionary(Of Integer, String)
    xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
    xlWorkSheet.Activate()
    If ComboBox2.Items.Count = Nothing Then
    With xlWorkSheet
    Dim LastCol As Integer = xlWorkSheet.Cells(1, xlWorkSheet.Columns.Count).End(XlDirection.xlToLeft).Column
    For x As Integer = 2 To LastCol
    Excols.Add(x, xlWorkSheet.Cells(1, x).value.ToString)
    Next
    ComboBox2.DataSource = New BindingSource(Excols, Nothing)
    ComboBox2.ValueMember = "Key"
    ComboBox2.DisplayMember = "Value"
    AddHandler ComboBox2.SelectedIndexChanged, AddressOf ComboBox2_SelectedIndexChanged
    End With
    Else
    MsgBox("Déja Pleine!", CType(MessageBoxIcon.Error, MsgBoxStyle))
    End If
    End Sub
    please help me 

    Hi
    >> when i select again the same column a message box will be shown "you have already select it
    Each time you select a value in the comobox , you could compare
     each cell’s value with the value you just selected in the first row. If  it is matched, then show the message box" you have already select it "
    >>And when i go back to choose another sheet then another column will be open without getting any error
    I am not sure the sentence’s meaning clearly, What do you mean about another column will be open?  what's the error , Can you clarify this more
    clear?
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I get the name of the column in Cursor

    hi,
    how can i derive the name of the columns in cursor
    e.g
    suppose I have a cursor
    cursor c is select * from emp;
    c1 c%rowtype.
    for c1 in c
    I want to display the name of the column how can I do. i don't
    remember the name, but i need it to be displayed tooo.
    thanx in advance
    Sreekant

    You can only do this by DESCing the tables in the cursor and
    then coding eg. v_no := c1.empno;
    APC

  • How to change the name of the column for dynamic query

    I would like to change the name of the column name to bidderone, biddertwo and bidderthree. the only problem is the vendors name unknown when I run the query and sometimes the query returns two vendors. the maximum vendor is three. here is the query and please let me know how this can be done. thank you so much. I am using oracle 10i
    FOR lv_rec IN   ( SELECT vendor, calcbtot
      FROM (SELECT t.*, ROW_NUMBER () OVER (ORDER BY t.calcbtot Asc) rn
              FROM (  SELECT DISTINCT
                             s.vendor,
                             TO_CHAR (s.calcbtot, '999,999,999.00') calcbtot
                        FROM bidtabs b, bidders s
                       WHERE     b.CALL = s.CALL
                             AND b.letting = s.letting
                             AND b.vendor = s.vendor
                             AND b.letting = v_letting
                             AND b.CALL = v_call
                    ORDER BY 2) t)
    WHERE rn <= 3 )                 
       LOOP
          lv_sql :=
                lv_sql  || ', TO_CHAR(MAX(DECODE(TRIM(S.VENDOR),'''|| TRIM (lv_rec.vendor) || ''', S.BIDPRICE)),  ''$999,999,999.00'') AS "'|| TRIM (lv_rec.vendor) ||'" ';
       END LOOP;

    thank you so so much for your help on this. I am sorry i did not post the entire code. my intention is to use bidderone, biddertwo,bidderthree as a column name insead of the name of the vendors and also calcuate the average of the three vendors. the maximum vendor will be three but the minumum could be one or two. hope this is enought information to help me out further . thank you
    CREATE OR REPLACE PROCEDURE biddersquoteforbridge (
       p_spnumber   IN       VARCHAR2,
       p_result     OUT      sys_refcursor
    IS
       v_letting   VARCHAR2 (40);
       v_call      VARCHAR2 (40);
       lv_sql      VARCHAR2 (32767) := NULL;
    BEGIN
       SELECT DISTINCT L.LETTING, CALL
                  INTO v_letting, v_call
                  FROM LETPROP L, PROPOSAL P
                 WHERE L.LCONTID = P.CONTID AND CPROJNUM= p_spnumber;
       lv_sql :=
          'SELECT   O.PRPITEM "Item Number",
                    INITCAP(FUNC_GET_ITEM_DESCRIPTION(O.PRPITEM)) "Description",
                    O.CONTID "Contract Id",O.SECTION "Section" , P.CPROJNUM "SP Number", P.CFACSSUP "District",
                    FUNCT_GET_SECTION_IDENTIFIER(O.SECTION, O.CONTID) "Section Title",  ''Q''||(TO_CHAR(D.DATELET, ''Q-YYYY'')) "Quarter",
                    O.IPLINENO "Line Number", O.QTY "Quantity" ';
      FOR lv_rec IN   ( SELECT vendor, calcbtot
      FROM (SELECT t.*, ROW_NUMBER () OVER (ORDER BY t.calcbtot Asc) rn
              FROM (  SELECT DISTINCT
                             s.vendor,
                             TO_CHAR (s.calcbtot, '999,999,999.00') calcbtot
                        FROM bidtabs b, bidders s
                       WHERE     b.CALL = s.CALL
                             AND b.letting = s.letting
                             AND b.vendor = s.vendor
                             AND b.letting = v_letting
                             AND b.CALL = v_call
                    ORDER BY 2) t)
    WHERE rn <= 3 )                 
       LOOP
          lv_sql :=
                lv_sql  || ', TO_CHAR(MAX(DECODE(TRIM(S.VENDOR),'''|| TRIM (lv_rec.vendor) || ''', S.BIDPRICE)),  ''$999,999,999.00'') AS "'|| TRIM (lv_rec.vendor) ||'" ';
       END LOOP;
       lv_sql :=
             lv_sql
          || '
            FROM   PROPITEM O  ,                   
                   PROPOSAL P  ,
                   LETPROP  L  ,
                   BIDDERS  B  ,
                   BIDTABS  S  ,
                   BIDLET   D
             WHERE O.CONTID = P.CONTID
                    AND P.CONTID = L.LCONTID
                    AND L.CALL = B.CALL
                    AND L.LETTING = B.LETTING
                    AND B.CALL = S.CALL             
                    AND B.LETTING = S.LETTING
                    AND B.VENDOR = S.VENDOR 
                    AND S.IPLINENO = O.IPLINENO
                    AND L.LETTING = D.LETTING             
                    AND O.LINEFLAG =''L''    
                    AND L.LETTING = :B1
                    AND L.CALL = :B2
             GROUP BY
                   O.CONTID,
                   O.SECTION,
                   O.IPLINENO,
                   O.PRPITEM,
                   O.QTY,
                   P.CPROJNUM,
                   P.CFACSSUP,
                   O.PRICE ,
                   D.DATELET             
             ORDER BY O.IPLINENO ';
      -- DBMS_OUTPUT.put_line (lv_sql);
       OPEN p_result FOR lv_sql USING v_letting, v_call;
    END;

  • How can i set a column which would show me the name of the user

    how can i write a trigger which would show me the name of the user now make changes in the table.

    872959 wrote:
    how can i write a trigger which would show me the name of the user now make changes in the table.I think what sb is trying to say is: if you mean the database user, you can use the USER session variable to identify the database user:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions227.htm#SQLRF06156
    you would write a before each row trigger to update an "updated_by" column on your table to be USER.
    e.g.:
    :new.updated_by := USER;

  • How to get the name of the selected building block in a building block content control?

    Hello,
    How can I obtain the name of the selected building block in a building block content control?
    I want to use this together with an on exit-event to populate other content Controls depending on the name of the selected building block item.
    Environment: Word 2010.
    Thanks,
    Peeter

    Hi Peeter,
    As far as I know the building block is the pre-built content, and the
    BuildingBlock object represents a building block in a template. After add the building block to the document, it inserts the content to the document.
    Building blocks are stored in the templates, therefore, to access the building blocks available for a document, we need to access an attached template.
    So, I think, we can’t obtain selected building block in the document.
    There are some links that may benefit you:
    # BdingBlock Object (Word)
    https://msdn.microsoft.com/en-us/library/office/ff192414.aspx?f=255&MSPPError=-2147217396
    # Working with Building Blocks
    https://msdn.microsoft.com/en-us/library/office/ff837878.aspx
    # Set the Building Blocks That You Can Use for a Content Control
    https://msdn.microsoft.com/en-us/library/office/ff197523.aspx
    Regards
    Starain
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Getting the name of the column using MDM API

    Hi I want to know the Column name from fieldId, can any one help me on this. I am using the following code to get the data but i nedd column name to which the data is refering
    ArrayList mdmData=new ArrayList();
    RecordResultSet rs=(RecordResultSet)obj;
    FieldId field[];
    for(int i=0;i<rs.getRecords().length;i++)
           field=rs.getRecords()<i>.getFields();
                for(int j=0;j<field.length;j++)
                    mdmData.add(rs.getRecords()<i>.getFieldValue(field[j]));
    Regards,
    Sandeep

    Hi Sandeep,
    When you fetched the FieldID from FieldProperties object. There is one more method to this class named FieldProp.getName(). This returns you the Name of the Field. You can store that too if you need it later.
    Thanks
    Namrata

  • Getting the name of the table of a column in a result

    I am connected via ODBC (3.52) to an Oracle 8i Db in a Windows 2000 application and want to get the name of the table a column of the result belongs to. I tried SQLColAttribute and SQLGetDescField with SQL_DESC_TABLE_NAME (that works fine with MsAccess), but always get an empty string. Is there another way of getting such information, or do I need another driver, or am I lost in space and time now?

    You can query ALL_TAB_COLS directly if you want.

  • Tracking the name of the column that is changed

    hi
    How i can track the following information about a table
    say i hve the table name tab1 which is like this
    col1 col2
    1 2
    Now if i change the value of col1 by a trigger i can track the change value but how can i track the name of the column
    say in the table tab2 i am tracking the result
    changed_col_name changed_val prev_val
    now changed val and prevval can be tracked by trigger but in the column changed_col_name how i can track the name of the column which i changed?
    Thanx in advance

    You are being rather unclear here.
    If you change the name of a column your trigger will need to be amended. I don't think you're actually asking to track changing actual column names.
    What you require is to track value changes and want to know how to assign which value to which column.
    each value is associated with a column, therefore if you track that the 5th value in your value clause has changed that means that the column that is affected is the 5th column in your column list.
    A simple if block would do the trick.
    But probably a better suggestion is to store the rows in a history table.
    Each time theres a change insert into the history table (which has its key column based on a sequence or a timestamp)
    Then to see whats changed you can merely compare the current row to the previous row

  • I need to create an action or script to save the file with the name of the selected layer

    I need to create an action or script to save the file with the name of the selected layer (not including the hidden layers, but including those visible).
    How could modify the script: 'Layer Comps To Files.jsx' to get the result?
    Warning: I do not need to export all layers as files.
    Who can help me?
    THX in advance

    Versione in Italiano (Further down the English version)
    NB - Nella versione inglese ho messo tutte le immagini dei menu in italiano.
    Versione per Mac, ma credo sia identico per Windows.
    Spiego passo passo cosa ho fatto:
    - Ho creato un file esempio con tre Livelli, salvato sulla scrivania e ho chiuso il file.
    - Ho aperto il file e selezionato il Livello al centro per iniziare a registrare una azione che ho chiamato: Save with Name of Selected Layer
    - Nuova azione
    - Dare il nome e premere Registra
    Ora salva…
    - Menu --> Livello --> Nuovo --> Livello... e premi -ok-, (lascia il nome che viene mostrato)
    - Ancora una volta Menu --> Livello... --> Nuovo --> Livello... e premi -ok-, (lascia il nome che viene mostrato)
    - Menu --> Livello --> Ordina --> Dietro
    - Menu --> Livello --> Unisci sotto
    - Menu --> Livello --> Unisci visibili
    - Menu --> Livello --> Nuovo --> Livello... e premi -ok-, (lascia il nome che viene mostrato)
    - Menu --> Livello - Nascondi Livello
    - Menu --> Elimina --> Elimina livelli nascosti (press -Yes-)
    - Menu --> Livello --> Nuovo --> Livello... Inserisci questo: 'Move this to the trash' e premi ok
    - Menu --> File --> Script --> Esporta Livelli in File... (Nella finestra che si apre scegliere l’opzione che si desidera, ma togliere il prefisso del nome) e premere -Esegui-
    - Selezionare il pannello Storia cliccare su Elimina premendo -Si- ogni volta che si apre la finestra di dialogo (Ripetere 8 volte questa operazione sino ad arrivare nella storia alla condizione di partenza. Ho visto che è meglio di Ripristina -F12-)
    - Fermare la registrazione.
    A questo punto, mandando in esecuzione questa Azione, ho raggiunto parzialmente l’obiettivo perché i file così creati mantengono, purtroppo, dei prefissi numerici per evitare probabilmente la sovrascrizione di file (credo senza avviso) nel posto dove vengono creati.
    Per ottenere l’obiettivo occorre un nuovo passo ed a proposito di questo riferisco quanto segue:
    ATTENZIONE - L’operazione descritta qui di seguito deve essere fatta su di una copia del file, per cui:
    - Duplicare il file,
    - Spostare l’originale in altra cartella
    - Lavorare sul file duplicato.
    mi riferisco a questo...
    ATTENZIONE - Questa modifica è effettuata a proprio rischio e pericolo ed il sottoscritto non si assume alcuna responsabilità su quanto venga fatto soprattutto da mani inesperte.
    ATTENZIONE - Questa modifica sovrascrive qualsiasi file che abbia nome uguale al layer che viene selezionato più l’estensione del file naturalmente.
    Comunque la modifica è banalissima e a portata di chiunque.
    Procedere così:
    - Chiudere Photoshop
    - Aprire (nel percorso specificato dall’immagine) il file “Export Layers to Files.jsx” (Export Layers To Files.jsx 1.0.0.16) con un editor di testo puro.
    - cercare la stringa (dovrebbe essere in riga 1029)
    var fileNameBody = fileNamePrefix;
    fileNameBody += "_" + zeroSuppress(i, 4);
    fileNameBody += "_" + layerName;
    - sostituirla con:
    var fileNameBody = fileNamePrefix;
    fileNameBody += layerName;
    - cercare la stringa (dovrebbe essere in riga 1047-46)
    var fileNameBody = fileNamePrefix;
    fileNameBody += "_" + zeroSuppress(i, 4) + "s";
    - sostituirla con:
    var fileNameBody = fileNamePrefix;
    fileNameBody += "";
    - salvare e uscire.
    - riavviare Photoshop
    - provare l’azione registrata facendo attenzione che il nome del layer non sia identico al nome di un file già presente altrimenti questo verrà sovrascritto.
    Domanda:
    Perché ho creato livelli che poi ho eliminato ecc.
    Risposta:
    Semplice per evitare errori di esecuzione delle azioni nel caso di operazioni con livelli mancanti o altro.
    Semplice... no?
    English version
    Mac version, but I think it's the same for Windows.
    First of all, I'm translating the actions that I made using the Italian version of Photoshop, you look at the position of the menu that I have chosen to do the work with other languages.
    I explain step by step what I did:
    - I created a sample file with three layers, saved to the desktop and I closed the file.
    - I opened the file and select the layer at the center to start recording an action that I called: Save with Name of the Selected Layer
    - New action
    - Give the name and press Save ( I think it is so in English )
    Now save ...
    - Menu -> Layer - > New —> Layer… and press -ok- , (leave the name that is shown)
    - Once again Menu -> Layer - > New —> Layer… and press -ok- , (leave the name that is shown)
    - Menu -> Layer - > Arrange (order) -> Behind
    - Menu -> Layer - > Merge Down
    - Menu -> Layer - > Merge Visible
    - Menu -> Layer - > New —> Layer… and press -ok- , (leave the name that is shown)
    - Menu -> Layer - Hide Layer
    - Menu - > Delete - > Delete hidden layers (press -Yes- )
    - Menu -> Layer - > New —> Layer… Enter this: ' Move this to the trash ' and press ok
    - Menu -> File - > Scripts -> Export Layers To Files... (In the window that opens select the option you want, but take away the name prefix) and press - Run -
    - Select the History panel and click Delete (on menu opened) pressing -Yes- every time when open the dialog box (8 times Repeat this step until you get into the story to the starting condition. Not use Restore -F12-).
    - Stop recording.
    At this point, by executing this action, I have reached the goal partly because the files created in this way remain, unfortunately, the numerical prefixes to avoid possibly overwriting of files (I think without notice) in the place where they are created.
    To achieve the goal we need a new step and thinking about this as follows:
    WARNING - The operation described below should be made on a copy of the file, so :
    - Duplicate the file
    - Move the original folder to another
    - Work on the duplicate file.
    WARNING - This modification is performed at your own risk and the undersigned assumes no responsibility on what is done mostly by inexperienced hands.
    WARNING - This change will overwrite any files with the same name as the selected layer plus the file extension of course.
    However, the change is trivial and within reach of anyone.
    Proceed as follows:
    - Close Photoshop
    - Open (in the specified path from the image ) file " Export Layers to Files.jsx " (Export Layers To Files.jsx 1.0.0.16) with a pure text editor.
    - Search for the string (should be in line 1029 )
    var = fileNameBody fileNamePrefix ;
    fileNameBody = + "_" + zeroSuppress (i, 4 ) ;
    fileNameBody + = "_ " + layerName ;
    - Replace it with :
    var = fileNameBody fileNamePrefix ;
    fileNameBody + = layerName ;
    - Search for the string (should be in line 1047-46 )
    var = fileNameBody fileNamePrefix ;
    fileNameBody + = "_ " + zeroSuppress (i, 4) + "s" ;
    - Replace it with :
    var = fileNameBody fileNamePrefix ;
    fileNameBody + = "";
    - Save and exit.
    - Restart Photoshop
    - Try the recorded Action, making sure that the layer name is not identical to the name of an existing file otherwise it will be overwritten.
    Question:
    Why I created levels which I then deleted etc..
    Answer:
    Simple to avoid errors of execution of the actions in the case of transactions with missing levels and other.
    Simple ... is not it?
    Sorry for my bad English...
    Thanks in advance for any hint.
    --->>> Please think about this... Adobe <<<---

  • SAP Query; change the name of the selection fields

    Hi,
    I created a SAP query using SQ01. When I execute the report, the selection field are the names of the table fields. As an example, I would like to change the selection field name «Customer number 1» for «Customer number». How can I change this selection field name in a SAP Query?
    Thanks,
    Julien

    Check Page Number 8 of this below mentioned document
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40bec8da-4cd8-2910-27a9-81f5ce10676c

  • Getting the name of the generic class?

    I have a generic class declared as such:
    public class MyClass<T>
    and I want to access the name of the <T> class a member function in that class? I just can't figure out which syntax to use.
    Thank you!
    Joshua

    Sorry, I'm a little bit confused at your answer.
    I cannot seem to instantiate an object of class T, like: T item = new T();does not work. If I can't create an object of type T, then I can't get it's type. I need to get the class even if I don't have any instantiated objects (or if I can create a blank one), so that I can use the name to fetch the objects from the persistence engine. Here is the class, so you can see what I'm talking about. I have in there now what seems like it should be right, but doesn't compile.
    A small example of solution please?
    public class PersistentSelectorCellEditor<T> extends AbstractCellEditor
              implements TableCellEditor {
         JComboBox control;
         List<T> choices;
         Session session;
         public PersistentSelectorCellEditor() {
              initializeComponents();
         public PersistentSelectorCellEditor(Object value) {
              initializeComponents();
              this.control.setSelectedItem(value);
         private void initializePersistence() {
              session = LabApp.getSession();
              session.beginTransaction();
         private void initializeComponents() {
              initializePersistence();
              populateList();     //query for selections to fill combo box
              control = new JComboBox((ComboBoxModel)choices);
         private void populateList() {
              //query to populate drop down lists
              Query query = session.createQuery("from " + T.class.getName());
              choices = query.list();
         public void setValue(T value) {
              control.setSelectedItem(value);
         public T getValue() {
              return (T)control.getSelectedItem();
         //interface members
         public Object getCellEditorValue() {
              return control.getSelectedItem();
         public Component getTableCellEditorComponent(JTable table, Object value,
                   boolean isSelected, int row, int column) {
              return control;
    }Thank you!
    Joshua

  • "Who ran me" - how to determine the name of the dbms_scheduler job that ran me

    Hi Community
    I can see plenty of examples out on the interweb which shows how you can use dbms_utility.format_call_stack to find the hierarchy of procs, functions and packages that got me to a particular point in my code.
    For example, if proc (procedure) A calls proc B, which in turn calls proc C, in the code for proc C, I can query the call stack to find out that proc C was called by proc B which in turn was called by proc A
    However, I want to extend this further.
    For example, using the example above, if proc A in turn was started by a dbms_scheduler job, I want to determine (within proc C) the name of the dbms_scheduler job which started the whole process off.
    The reason I want to do this is that I have inherited a (massive) system which is undocumented. In many places within the code, email alerts are sent out using a custom "MAIL" package to designated users (now including me) when certain long-running processes reach certain milestones and/or complete.
    I have added to the custom "MAIL" package a trailer on the mails to show the call stack. I also want to show the name of the dbms_scheduler job which started it all.
    Over time, this info may help me in building the "map" of how the whole undocumented system hangs together and in the meantime, to assist in troubleshooting problems
    Looking forward to hearing from you
    Alan

    Use USER_SCHEDULER_RUNNING_JOBS or DBA_SCHEDULER_RUNNING_JOBS there is column SESSION_ID and when you know your session ID build query is very simple.
    select owner, job_name
    into ...
    from dba_scheduler_runnig_jobs
    where session_id=sys_context('USERENV','SESSIONID');
    You must declare local variables in PL/SQL procedure to read owner and job_name into them. Second thing, you must handle possible exception no_data_found than can be raised when procedure is not run from job.

  • Can the name of the TASK bound to process level determined dynamically?

    In the 'Complete and Order' step of shopping cart scenario, we can display/ edit agents. This function enable us to see the approver list. In the 2nd column Process Step, there will be a description of the approver, which is the name of the corresponding task in the BRF process level. But when we want to reuse the task for several process level, we need to dynamically set this description. Since it is a name of the TASK, how can we achieve that?
    Thanks for reading.

    Actually this is what I was trying to do:
    <select name="<c:out value="${id}"/>versions" >
    <c:if test="${param.{id}versions == yyy}"> selected </c:if>
    </select>
    Do you know how to make the comparision works? The problem is the double curly bracket.
    Thanks again

  • How can I keep Itunes from wanting to put my music cd in the compilations folder.  Even a 2 disc set sometimes itunes will place one cd in a folder of the name of the band and the other disc in the compilations folder under the name of the cd

    Two issues.  The first one is that when I upload some music cd's into my itunes library, itunes wants to place the songs in a compilations folder.  Sometimes this occurs even with a 2 or 3 cd set.  One CD will be filed under the artists name and the disc 2 may be filed in the compilations folder and listed by the name of the cd and not the artist.
    2nd issue is that sometimes cd's are similiar, but with different artists such as 20th century Hits of Neil Young.  The CD is filed in the compilations folder.  Than I upload the 20th century Hits of Tanya Tucker and the songs go into the same folder with Neil Young.  The don't even mix as one is county and the other is rock.
    I have moved these CD's out of the compilations folder and moved them in with the other cd's by the same artist, but Itunes keeps moving them back into the compilations folder.
    Is there a fix

    Generally setting a common Album title and Album Artist will fix things.
    For compilations that aren't, select all tracks, Get Info, and on the option tab set Part of a Compilation to No. If it already says No tick the box alongside, then click OK.
    For deeper problems see Grouping tracks into albums.
    tt2

Maybe you are looking for

  • X230 with windows 7 still won't connect to any bluetooth devices after many attempted solutions

    My starting point: I have 6 month old x230 with windows 7, all windows and lenovo updates already completed.  The bluetooth logo exists on the bottom of screen but when I try to "add device" it doesn't recognize any bluetooth devices.  I've tried thi

  • Failure handling message problem in deployment

    Hi, JDev 11.1.1.5.0 I have some transient attributes in EO and mandatory=true. I have given validation failure handling message. It is properly showing in my local system with highligting the attribute but after deployment on sever all the transient

  • Difference in print preview and actual print

    hi all, we are using o/p types and sap scrits to get the print out. but there is a diff betwenn the preview and actual print. some fields that are not visible or suppressed in the preview are appeearing on the print. moreover if the same invoice is p

  • How to put pdf file on crystal reports.

    Hi all, I'd like to put pdf file which is the attachment of Item master on crystal reports. I tried OITM.attachment but it only shows the location where the file is, not file itself. Thanks in advance.

  • MIC in receipt did not match the original message's MIC

    Hi Does anybody has any idea about the error mentioned in the subject line. We have configured Oracle B2B 10.1.2 for XML messages exchange with TP. Our trading partner reports saying his AS2 machine shows the above error eventhough host B2B(Oracle) d