Laden...
Scarecraft
myCSharp.de - Member
54
Themen
268
Beiträge
010010000110100100100000011011010111100100100000011011100110000101101101011001010010000001101001011100110010000001010011011000110110000101110010011001010110001101110010011000010110011001110100
Letzte Aktivität
vor 14 Jahren
Dabei seit
02.03.2008
Alter
36
Beruf
Technischer Assistent für Informatik
Herkunft
Lingen
Interessen
Programmieren
Erstellt vor 14 Jahren

Vielen Dank für die vielen Ansätze,
ich werde mich da mal durchschauen und das "passendste" für mein Projekt nutzen. Danksehr!

Erstellt vor 14 Jahren

Danke FZelle,
Dann werd ich mir den Treeview mal genauer anschauen.
Ich hab halt vor einen Setup zu basteln wie bei der VS installation:
http://www.guysmithferrier.com/images/VS2008Installation1.jpg
Gruß Christopher

Erstellt vor 14 Jahren

Hallo ich suche ein Control das :

Drei Spalten hat.

1.Spalte Bild(Kann dynamisch während der laufzeit geändert [Ausgetauscht] werden)
2. Spalte Bild (Kann dynamisch während der laufzeit geändert [Ausgetauscht] werden)
3. Bezeichnung

Eventuell könnte ich auch Spalte 1 & 2 verbinden und dafür ein Bild machen das beides hat. also wäre das auch kein Problem. Ich brauche quasi nur eine Tabelle die Bilder schlucken kann.

zum besseren verständnis hab ich mal ein Bild gebastelt gg.

Die Legende rechts gehört net dazu.Ist nur zum besseren Verständnis.

Hat jemand eine Idee wie ich das Realisieren kann ?
Danke schonmal und Gruß Scare

Erstellt vor 14 Jahren

Ich hab es herausgefunden. Danke an alle die mir geholfen haben.gruß Christopher

Erstellt vor 14 Jahren

Also diese Objekte die er nicht erkennt sind Objekte die dir in VBA in Word
automatisch zur Verfügung stehen. Im Klartext Word.Application.
In C# musst du Word natürlich referenzieren und eine Instanz ertellen.
Documents zb. ist:

Word.Application wordApp = new Word.Application();
wordApp.Documents;

Dir ist sowas wie System.IO.File.Exists kurz und knapp gesagt.

Okay vielen Dank ich bin nun ein stückchen weiter. Er erkennt nun die Objekte. Leider sind die wohl auch nen bissl anders. Und er will bei

 objDoc = Documents.Open(strFilePath + strFileName);

das nicht schlucken. Er sagt nur der Pfad wäre ihm zu wenig. Und bietet mir an da geschätzte 20 argumente mehr reinzupacken. Nur hab ich keine ahnung was ich da noch alles reinpacken soll. Ich hab das ganze mal als screenshoot angehängt.

Im internet hab ich noch das hier gefunden :

object fileName = @"C:\Test\NewDocument.doc"; 

this.Application.Documents.Open(ref fileName,
    ref missing, ref missing, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing, ref missing, ref missing,
    ref missing, ref missing, ref missing, ref missing, ref missing);

bzw in meinem Fall:

objDoc = Documents.Open(ref strFilePath+strFileName,
     ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing,
    ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing,
    ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing, ref Type.Missing);

aber das versteh ich nicht ganz.Da meckert der auch wieder rum.. ich will doch nur das das Programm läuft 🙁
hat einer eine ahnung wie ich dem Document.open nun nur den Pfad mitgeben kann ?..mehr hab ich ja auch nicht.

Wieso kann M$ denn das ganze nicht als .exe oder auch in C# anbieten ich hab hier die Bude am brennen und bekomm das net ans laufen ...

mein Sourcecode bisher:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Scripting;
using System.Threading;
using Microsoft.Office.Interop.Word;
namespace Mainka_Vorlagen
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox3.Text != "" && textBox3.Text != null && textBox1.Text != "" && textBox1.Text != null && textBox2.Text != "" && textBox2.Text != null)
            {
                System.Threading.Thread newThread;
                newThread = new System.Threading.Thread(Test);
                newThread.Start();
               
            }
            else
                MessageBox.Show("Bitte zuerst alle Felder ausfüllen!");
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }


        void Test()
        {
            try
            {
                //Deklaration

                string strFilePath;
                string strPath;
                int intCounter;
                string strFileName;
                string OldServer;
                string NewServer;


                Document objDoc = new Document();
                Template objTemplate ;
                Dialog dlgTemplate;

                //einlesen der Servernamen//Wertzuweisung
                OldServer = textBox1.Text;
                NewServer = textBox2.Text;
                strFilePath = textBox3.Text;

                //Wenn Pfadname am anfang nicht \\ hat diesen einfügen
                if ((strFilePath.Substring((strFilePath.Length - 1)) != "\\"))
                {
                    strFilePath = (strFilePath + "\\");
                }
                //Dateiendung hinzufügen
                strFileName = strFilePath + "*.doc";

                while ((strFileName != ""))
                {
                    object name = strFilePath + strFileName;
                    
                    object no = false;

                    objDoc = Documents.Open(ref name, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no, ref no);

                    objTemplate = objDoc.get_AttachedTemplate();
                    dlgTemplate = Dialogs(wdDialogToolsTemplates);
                    strPath = dlgTemplate.Template;
                    if ((strPath.Substring(0, 13).ToLower() == OldServer.ToLower()))
                    {
                        objDoc.AttachedTemplate = (NewServer + strPath.Substring(13));
                    }
                    strFileName = Dir();
                    objDoc.Save();
                    object save = true;
                    objDoc.Close(ref save);
                }
                objDoc = null;
                objTemplate = null;
                dlgTemplate = null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler:" + ex.Message);

            }


        }

        private void button2_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
           textBox3.Text= folderBrowserDialog1.SelectedPath;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = textBox1.Text;

            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName!= "")
           textBox1.Text= openFileDialog1.FileName;
        }

        private void button4_Click(object sender, EventArgs e)
        {
            openFileDialog1.InitialDirectory = textBox2.Text;
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName != "")
                textBox2.Text = openFileDialog1.FileName;
        }

        
    }
}

Gruß Christopher

Erstellt vor 14 Jahren

Hallo liebe Comunity,
Ich versuche grad ganz dringend folgenden Artikel :
http://support.microsoft.com/kb/830561/DE/#3(Punkt 3)
nach C# umzubauen.

Orginal VB

Sub Test()
        Dim strFilePath As String
        Dim strPath As String
        Dim intCounter As Integer
        Dim strFileName As String
        Dim OldServer As String
        Dim NewServer As String
        Dim objDoc As Document
        Dim objTemplate As Template
        Dim dlgTemplate As Dialog

        OldServer = "<\\rsnj01\vol1>"
        NewServer = "<\\rsnyc1p\vol3>"
        strFilePath = InputBox("What is the folder location that you want to use?")
        If Right(strFilePath, 1) <> "\" Then strFilePath = strFilePath & "\"
        strFileName = Dir(strFilePath & "*.doc")
        Do While strFileName <> ""
            objDoc = Documents.Open(strFilePath & strFileName)
            objTemplate = objDoc.AttachedTemplate
            dlgTemplate = Dialogs(wdDialogToolsTemplates)
            strPath = dlgTemplate.Template
            If LCase(Left(strPath, 13)) = LCase(OldServer) Then
                objDoc.AttachedTemplate = NewServer & Mid(strPath, 14)
            End If
            strFileName = Dir()
            objDoc.Save()
            objDoc.Close()
        Loop
        objDoc = Nothing
        objTemplate = Nothing
        dlgTemplate = Nothing

    End Sub

Das C# Programm:


 
    void Test() {
        string strFilePath;
        string strPath;
        int intCounter;
        string strFileName;
        string OldServer;
        string NewServer;
        Document objDoc;
        Template objTemplate;
        Dialog dlgTemplate;
        OldServer = "<\\\\rsnj01\\vol1>";
        NewServer = "<\\\\rsnyc1p\\vol3>";
        strFilePath = InputBox("What is the folder location that you want to use?");
        if ((strFilePath.Substring((strFilePath.Length - 1)) != "\\")) {
            strFilePath = (strFilePath + "\\");
        }
        strFileName = Dir((strFilePath + "*.doc"));
        while ((strFileName != "")) {
            objDoc = Documents.Open((strFilePath + strFileName));
            objTemplate = objDoc.AttachedTemplate;
            dlgTemplate = Dialogs(wdDialogToolsTemplates);
            strPath = dlgTemplate.Template;
            if ((strPath.Substring(0, 13).ToLower() == OldServer.ToLower())) {
                objDoc.AttachedTemplate = (NewServer + strPath.Substring(13));
            }
            strFileName = Dir();
            objDoc.Save();
            objDoc.Close();
        }
        objDoc = null;
        objTemplate = null;
        dlgTemplate = null;
    }

Leider hab ich mal so keine ahnung von VB. Und stoße bei Folgendem auf Problemen:

Die Objekte :
Document ,Template, Dialog
(wobei letzteres net so das Problem sein dürfte)
werden nicht erkannt. Ich hab dannach gegooglet ob evtl. ein verweis fehlt aber naja das ist bei solchen Namen wie die Nadel im Heuhaufen.

Dann erkennt er "Dir" nicht. Aber das ist glaubich ne VB sache. Gibt es dazu nen C# Äquivalent?(vielleicht Directory?)
Naja das wars auch eigendlich. Ich brauche das Script halt dringend am laufen kann mir bitte bitte wer helfen ?

Danke schonmal im vorraus
Christopher

Erstellt vor 14 Jahren

Ich bin Admin Azubi ,
Ich will ganz schnell ein Tool haben das diese recht simple Aufgabe erfüllt, also würde ich eher nicht WMI verwenden (wenn es nach deiner aussage her wirklich aufwendiger wäre) Die Leute die das brauchen brauchen es wie immer Gestern 😉 . Naja es sollte ja auch NUR diese Funktion haben , nicht mehr und nich weniger und wird auch niemal mehr machen sollen als das.

@Theki , wieso denn ein Prozess? Ich dachte mir das so:
+---------------------+
|Label : DHCP/IP |
|Button : Ändere es |
+----------------------+
Also kein Prozess der das überwacht oder sowas. Oder hab ich da was falsch verstanden?
Also wirklich nichts aufwendiges.

Erstellt vor 14 Jahren

Hallo liebe Community,
Ich würde gerne was (ich glaube leichtes) Programmieren. Ein Programm
das als eine Art "Switch" funktioniert. Quasi so:

Status 1: Hat Netzwerkverbindung 2 DHCP eingestellt?
Wenn ja =>Gib ihm die addresse "192.168.195.130"
Wenn nein=>Stell ihn auf DHCP um.

Geht das einfach oder wirds doch etwas komplizierter? Also das mit der IP einstellen wird wohl sehr leicht denke ich aber wie stelle ich das mit dem DHCP ein, und wie sag ich ihm welche NW verbindung ich meine ? 😃 LG
Danke schonmal für die Hilfestellung Gruß Christopher

Erstellt vor 14 Jahren

Danke Tarion ich werd mir auch mal dein Beispiel anschauen.

Erstellt vor 14 Jahren

Schonmal mit Serialisation probiert?
Klick mich
Damit bekommst du aus einem XML ein Objekt.